From c34b790470475932cdcc1e6cec49c79d98cc7f34 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 7 Apr 2024 14:24:00 -0500 Subject: [PATCH] emu2413: YM2423 --- TODO.md | 1 - extern/emu2413/emu2413.c | 22 +++++++++++++++++++++- extern/emu2413/emu2413.h | 2 +- src/engine/platform/opll.cpp | 4 ++-- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index d45e7fb56..cc9a15767 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,5 @@ # to-do for 0.6.3 -- emu2413 - compress fonts further if possible - 9xxx for more chips diff --git a/extern/emu2413/emu2413.c b/extern/emu2413/emu2413.c index 7b50a6701..5a74ba90f 100644 --- a/extern/emu2413/emu2413.c +++ b/extern/emu2413/emu2413.c @@ -28,7 +28,7 @@ #define _PI_ 3.14159265358979323846264338327950288 -#define OPLL_TONE_NUM 3 +#define OPLL_TONE_NUM 4 /* clang-format off */ static uint8_t default_inst[OPLL_TONE_NUM][(16 + 3) * 8] = {{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 0: User @@ -92,6 +92,26 @@ static uint8_t default_inst[OPLL_TONE_NUM][(16 + 3) * 8] = {{ 0x01,0x01,0x18,0x0f,0xdf,0xf8,0x6a,0x6d, // R: Bass Drum (identical to YM2413) 0x01,0x01,0x00,0x00,0xc8,0xd8,0xa7,0x68, // R: High-Hat(M) / Snare Drum(C) (identical to YM2413) 0x05,0x01,0x00,0x00,0xf8,0xaa,0x59,0x55, // R: Tom-tom(M) / Top Cymbal(C) (identical to YM2413) +},{ +/* YM2423, taken from ymfm */ +0x61,0x61,0x1B,0x07,0x94,0x5F,0x10,0x06, +0x93,0xB1,0x51,0x04,0xF3,0xF2,0x70,0xFB, +0x41,0x21,0x11,0x85,0xF2,0xF2,0x70,0x75, +0x93,0xB2,0x28,0x07,0xF3,0xF2,0x70,0xB4, +0x72,0x31,0x97,0x05,0x51,0x6F,0x60,0x09, +0x13,0x30,0x18,0x06,0xF7,0xF4,0x50,0x85, +0x51,0x31,0x1C,0x07,0x51,0x71,0x20,0x26, +0x41,0xF4,0x1B,0x07,0x74,0x34,0x00,0x06, +0x50,0x30,0x4D,0x03,0x42,0x65,0x20,0x06, +0x40,0x20,0x10,0x85,0xF3,0xF5,0x20,0x04, +0x61,0x61,0x1B,0x07,0xC5,0x96,0xF3,0xF6, +0xF9,0xF1,0xDC,0x00,0xF5,0xF3,0x77,0xF2, +0x60,0xA2,0x91,0x03,0x94,0xC1,0xF7,0xF7, +0x30,0x30,0x17,0x06,0xF3,0xF1,0xB7,0xFC, +0x31,0x36,0x0D,0x05,0xF2,0xF4,0x27,0x9C, +0x01,0x01,0x18,0x0F,0xDF,0xF8,0x6A,0x6D, +0x01,0x01,0x00,0x00,0xC8,0xD8,0xA7,0x48, +0x05,0x01,0x00,0x00,0xF8,0xAA,0x59,0x55, }}; /* clang-format on */ diff --git a/extern/emu2413/emu2413.h b/extern/emu2413/emu2413.h index dbc0af1d9..9e60590a0 100644 --- a/extern/emu2413/emu2413.h +++ b/extern/emu2413/emu2413.h @@ -9,7 +9,7 @@ extern "C" { #define OPLL_DEBUG 0 -enum OPLL_TONE_ENUM { OPLL_2413_TONE = 0, OPLL_VRC7_TONE = 1, OPLL_281B_TONE = 2 }; +enum OPLL_TONE_ENUM { OPLL_2413_TONE = 0, OPLL_VRC7_TONE = 1, OPLL_281B_TONE = 2, OPLL_2423_TONE = 3 }; /* voice data */ typedef struct __OPLL_PATCH { diff --git a/src/engine/platform/opll.cpp b/src/engine/platform/opll.cpp index 3a71d8c71..5f90fec1a 100644 --- a/src/engine/platform/opll.cpp +++ b/src/engine/platform/opll.cpp @@ -1011,7 +1011,7 @@ int DivPlatformOPLL::getRegisterPoolSize() { } static const unsigned char nukedToEmuPatch[4]={ - 0, 2, 0 /* TODO */, 1 + 0, 2, 3, 1 }; void DivPlatformOPLL::reset() { @@ -1042,7 +1042,7 @@ void DivPlatformOPLL::reset() { if (selCore==1) { OPLL_reset(fm_emu); OPLL_setChipType(fm_emu,vrc7?1:0); - OPLL_resetPatch(fm_emu,nukedToEmuPatch[patchSet&3]); + OPLL_resetPatch(fm_emu,vrc7?1:nukedToEmuPatch[patchSet&3]); } for (int i=0; i<11; i++) { chan[i]=DivPlatformOPLL::Channel();