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);