From 7c377fc88a3fbb7f69b91a15dc414c8965624a89 Mon Sep 17 00:00:00 2001 From: Nuke.YKT Date: Fri, 29 May 2015 02:00:45 +0900 Subject: Added OPL3 mode support. --- opl/opl_sdl.c | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) (limited to 'opl/opl_sdl.c') diff --git a/opl/opl_sdl.c b/opl/opl_sdl.c index 8834ee07..0621995f 100644 --- a/opl/opl_sdl.c +++ b/opl/opl_sdl.c @@ -71,6 +71,7 @@ static uint64_t pause_offset; // OPL software emulator structure. static Chip opl_chip; +static int opl_new; // Temporary mixing buffer used by the mixing callback. @@ -164,15 +165,30 @@ static void FillBuffer(int16_t *buffer, unsigned int nsamples) assert(nsamples < mixing_freq); - Chip__GenerateBlock2(&opl_chip, nsamples, mix_buffer); + if (opl_new) + { + Chip__GenerateBlock3(&opl_chip, nsamples, mix_buffer); - // Mix into the destination buffer, doubling up into stereo. + // Mix into the destination buffer, doubling up into stereo. - for (i=0; i timer1.expire_time) { result |= 0x80; // Either have expired @@ -439,6 +461,9 @@ static void WriteRegister(unsigned int reg_num, unsigned int value) break; + case OPL_REG_NEW: + opl_new = value & 0x01; + default: Chip__WriteReg(&opl_chip, reg_num, value); break; @@ -451,6 +476,10 @@ static void OPL_SDL_PortWrite(opl_port_t port, unsigned int value) { register_num = value; } + else if (port == OPL_REGISTER_PORT_OPL3) + { + register_num = value | 0x100; + } else if (port == OPL_DATA_PORT) { WriteRegister(register_num, value); -- cgit v1.2.3