From 2f9d1e8c0f3fac7f7b8971e4f1d3a7882ddef2b7 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 6 Mar 2022 18:10:12 -0500 Subject: [PATCH] i'll finish this later --- src/engine/platform/opl.cpp | 26 ++++++++++++++++++++++++-- src/engine/platform/opl.h | 7 ++++++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/engine/platform/opl.cpp b/src/engine/platform/opl.cpp index bb195a471..ebf7dc927 100644 --- a/src/engine/platform/opl.cpp +++ b/src/engine/platform/opl.cpp @@ -30,7 +30,6 @@ // N = invalid #define N 255 -/* const unsigned char slotsOPL2[4][20]={ {0, 1, 2, 6, 7, 8, 12, 13, 14}, // OP1 {3, 4, 5, 9, 10, 11, 15, 16, 17}, // OP2 @@ -45,6 +44,10 @@ const unsigned char slotsOPL2Drums[4][20]={ {N, N, N, N, N, N, N, N, N, N, N} }; +const unsigned char chanMapOPL2[20]={ + 0, 1, 2, 3, 4, 5, 6, 7, 8, N, N, N, N, N, N, N, N, N, N, N +}; + const unsigned char slotsOPL3[4][20]={ {0, 6, 1, 7, 2, 8, 18, 24, 19, 25, 20, 26, 30, 31, 32, 12, 13, 14}, // OP1 {3, 9, 4, 10, 5, 11, 21, 27, 22, 28, 23, 29, 33, 34, 35, 15, 16, 17}, // OP2 @@ -58,7 +61,10 @@ const unsigned char slotsOPL3Drums[4][20]={ {6, N, 7, N, 8, N, 24, N, 25, N, 26, N, N, N, N, N, N, N, N, N}, // OP3 {9, N, 10, N, 11, N, 27, N, 28, N, 29, N, N, N, N, N, N, N, N, N} // OP4 }; -*/ + +const unsigned char chanMapOPL3[20]={ + 0, 3, 1, 4, 2, 5, 9, 12, 10, 13, 11, 14, 15, 16, 17, 6, 7, 8, N, N +}; #undef N @@ -773,6 +779,22 @@ void DivPlatformOPL::setYMFM(bool use) { useYMFM=use; } +void DivPlatformOPL::setOPLType(int type) { + switch (type) { + case 1: case 2: + slotsNonDrums=(const unsigned char**)slotsOPL2; + slotsDrums=(const unsigned char**)slotsOPL2Drums; + chanMap=chanMapOPL2; + break; + case 3: + slotsNonDrums=(const unsigned char**)slotsOPL3; + slotsDrums=(const unsigned char**)slotsOPL3Drums; + chanMap=chanMapOPL3; + break; + } + oplType=type; +} + void DivPlatformOPL::setFlags(unsigned int flags) { /* if (flags==3) { diff --git a/src/engine/platform/opl.h b/src/engine/platform/opl.h index c42481927..ab6226a45 100644 --- a/src/engine/platform/opl.h +++ b/src/engine/platform/opl.h @@ -64,7 +64,11 @@ class DivPlatformOPL: public DivDispatch { }; std::queue writes; opl3_chip fm; - int delay; + const unsigned char** slotsNonDrums; + const unsigned char** slotsDrums; + const unsigned char** slots; + const unsigned char* chanMap; + int delay, oplType; unsigned char lastBusy; unsigned char regPool[512]; @@ -103,6 +107,7 @@ class DivPlatformOPL: public DivDispatch { void muteChannel(int ch, bool mute); bool isStereo(); void setYMFM(bool use); + void setOPLType(int type); bool keyOffAffectsArp(int ch); bool keyOffAffectsPorta(int ch); void toggleRegisterDump(bool enable);