aboutsummaryrefslogtreecommitdiff
path: root/libopna/opna.c
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2016-11-26 20:57:57 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2016-11-26 20:57:57 +0900
commit6fd10cdacb5cbe47a4fc339c20a733d4a9a384a1 (patch)
treec7f479a70c350dca0b73d76078e46db41d9c4133 /libopna/opna.c
initial
Diffstat (limited to 'libopna/opna.c')
-rw-r--r--libopna/opna.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/libopna/opna.c b/libopna/opna.c
new file mode 100644
index 0000000..4e198a0
--- /dev/null
+++ b/libopna/opna.c
@@ -0,0 +1,24 @@
+#include "opna.h"
+
+void opna_reset(struct opna *opna) {
+ opna_fm_reset(&opna->fm);
+ opna_ssg_reset(&opna->ssg);
+ opna_ssg_resampler_reset(&opna->resampler);
+ opna_drum_reset(&opna->drum);
+ opna_adpcm_reset(&opna->adpcm);
+}
+
+void opna_writereg(struct opna *opna, unsigned reg, unsigned val) {
+ val &= 0xff;
+ opna_fm_writereg(&opna->fm, reg, val);
+ opna_ssg_writereg(&opna->ssg, reg, val);
+ opna_drum_writereg(&opna->drum, reg, val);
+ opna_adpcm_writereg(&opna->adpcm, reg, val);
+}
+
+void opna_mix(struct opna *opna, int16_t *buf, unsigned samples) {
+ opna_fm_mix(&opna->fm, buf, samples);
+ opna_ssg_mix_55466(&opna->ssg, &opna->resampler, buf, samples);
+ opna_drum_mix(&opna->drum, buf, samples);
+ opna_adpcm_mix(&opna->adpcm, buf, samples);
+}