From d6dfe2636a19b409c2f33cc2637b7f9be65a52ac Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 17 Mar 2022 02:40:10 -0500 Subject: [PATCH] OPL: implement fixed frequency mode --- src/engine/platform/opl.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/engine/platform/opl.cpp b/src/engine/platform/opl.cpp index 53163114f..42ce11587 100644 --- a/src/engine/platform/opl.cpp +++ b/src/engine/platform/opl.cpp @@ -582,7 +582,19 @@ int DivPlatformOPL::dispatch(DivCommand c) { chan[c.chan].insChanged=false; if (c.value!=DIV_NOTE_NULL) { - chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value); + if (c.chan>=melodicChans && chan[c.chan].state.opllPreset==16 && chan[c.chan].state.fixedDrums) { // drums + if (c.chan==melodicChans) { + chan[c.chan].baseFreq=(chan[c.chan].state.kickFreq&1023)<<(chan[c.chan].state.kickFreq>>10); + } else if (c.chan==melodicChans+1 || c.chan==melodicChans+4) { + chan[c.chan].baseFreq=(chan[c.chan].state.snareHatFreq&1023)<<(chan[c.chan].state.snareHatFreq>>10); + } else if (c.chan==melodicChans+2 || c.chan==melodicChans+3) { + chan[c.chan].baseFreq=(chan[c.chan].state.tomTopFreq&1023)<<(chan[c.chan].state.tomTopFreq>>10); + } else { + chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value); + } + } else { + chan[c.chan].baseFreq=NOTE_FREQUENCY(c.value); + } chan[c.chan].note=c.value; chan[c.chan].freqChanged=true; }