summaryrefslogtreecommitdiffstats
path: root/lib/rbcodec/codecs/libayumi/ayumi.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libayumi/ayumi.h')
-rw-r--r--lib/rbcodec/codecs/libayumi/ayumi.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libayumi/ayumi.h b/lib/rbcodec/codecs/libayumi/ayumi.h
new file mode 100644
index 0000000000..66d767797e
--- /dev/null
+++ b/lib/rbcodec/codecs/libayumi/ayumi.h
@@ -0,0 +1,72 @@
+/* Author: Peter Sovietov */
+
+#ifndef AYUMI_H
+#define AYUMI_H
+
+enum {
+ TONE_CHANNELS = 3,
+ DECIMATE_FACTOR = 8,
+ FIR_SIZE = 192,
+ DC_FILTER_SIZE = 1024
+};
+
+struct tone_channel {
+ int tone_period;
+ int tone_counter;
+ int tone;
+ int t_off;
+ int n_off;
+ int e_on;
+ int volume;
+ double pan_left;
+ double pan_right;
+};
+
+struct interpolator {
+ double c[4];
+ double y[4];
+};
+
+struct dc_filter {
+ double sum;
+ double delay[DC_FILTER_SIZE];
+};
+
+struct ayumi {
+ struct tone_channel channels[TONE_CHANNELS];
+ int noise_period;
+ int noise_counter;
+ int noise;
+ int envelope_counter;
+ int envelope_period;
+ int envelope_shape;
+ int envelope_segment;
+ int envelope;
+ const double* dac_table;
+ double step;
+ double x;
+ struct interpolator interpolator_left;
+ struct interpolator interpolator_right;
+ double fir_left[FIR_SIZE * 2];
+ double fir_right[FIR_SIZE * 2];
+ int fir_index;
+ struct dc_filter dc_left;
+ struct dc_filter dc_right;
+ int dc_index;
+ double left;
+ double right;
+};
+
+int ayumi_configure(struct ayumi* ay, int is_ym, double clock_rate, int sr);
+void ayumi_set_pan(struct ayumi* ay, int index, double pan, int is_eqp);
+void ayumi_set_tone(struct ayumi* ay, int index, int period);
+void ayumi_set_noise(struct ayumi* ay, int period);
+void ayumi_set_mixer(struct ayumi* ay, int index, int t_off, int n_off, int e_on);
+void ayumi_set_volume(struct ayumi* ay, int index, int volume);
+void ayumi_set_envelope(struct ayumi* ay, int period);
+void ayumi_set_envelope_shape(struct ayumi* ay, int shape);
+void ayumi_process(struct ayumi* ay);
+void ayumi_seek(struct ayumi* ay);
+void ayumi_remove_dc(struct ayumi* ay);
+
+#endif