From 499d7dcf4912ba9b224a68439520407c25f8c9ae Mon Sep 17 00:00:00 2001 From: Takamichi Horikawa Date: Wed, 23 Aug 2017 21:15:14 +0900 Subject: LIBOPNA: ssg: added YMF288 mode --- libopna/opnassg.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'libopna/opnassg.h') 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 #include +#include #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; -- cgit v1.2.3