aboutsummaryrefslogtreecommitdiff
path: root/libopna/opnassg.h
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-08-23 21:15:14 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-08-23 21:15:14 +0900
commit499d7dcf4912ba9b224a68439520407c25f8c9ae (patch)
treeba01fe33daf3e0dfe533171df8444494ecd0f1d2 /libopna/opnassg.h
parentdfb3f4f10cc66a72027ae5869318cc10baf30a2e (diff)
LIBOPNA: ssg: added YMF288 mode
Diffstat (limited to 'libopna/opnassg.h')
-rw-r--r--libopna/opnassg.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/libopna/opnassg.h b/libopna/opnassg.h
index 3077d08..6b1d0cd 100644
--- a/libopna/opnassg.h
+++ b/libopna/opnassg.h
@@ -3,6 +3,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include <string.h>
#include "leveldata/leveldata.h"
#ifdef __cplusplus
@@ -31,6 +32,8 @@ struct opna_ssg {
unsigned mask;
int32_t previn[3];
int32_t prevout[3];
+ uint32_t mix;
+ bool ymf288;
};
struct opna_ssg_resampler {
@@ -63,6 +66,21 @@ unsigned opna_ssg_readreg(const struct opna_ssg *ssg, unsigned reg);
int opna_ssg_channel_level(const struct opna_ssg *ssg, int ch);
unsigned opna_ssg_tone_period(const struct opna_ssg *ssg, int ch);
+static inline void opna_ssg_set_ymf288(
+ struct opna_ssg *ssg, struct opna_ssg_resampler *resampler, bool ymf288) {
+ // enable bit-perfect with YMF288/OPN3-L mode
+ if (ssg->ymf288 != ymf288) {
+ ssg->ymf288 = ymf288;
+ memset(resampler->buf, 0, sizeof(resampler->buf));
+ }
+}
+
+static inline void opna_ssg_set_mix(struct opna_ssg *ssg, uint32_t mix) {
+ // 0x10000: default (PC-9801-86 equivalent)
+ // only valid when !ymf288
+ ssg->mix = mix;
+}
+
typedef void (*opna_ssg_sinc_calc_func_type)(unsigned resampler_index,
const int16_t *inbuf, int32_t *outbuf);
extern opna_ssg_sinc_calc_func_type opna_ssg_sinc_calc_func;