From e697c055b644a761a4a54c1e2a9c4d2557a3cc9e Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 20 Feb 2022 21:39:14 -0500 Subject: [PATCH] replay keyOn in active channels during forceIns fixes an issue when playing orders --- src/engine/platform/arcade.cpp | 6 ++++++ src/engine/platform/c64.cpp | 6 ++++++ src/engine/platform/genesis.cpp | 6 ++++++ src/engine/platform/genesisext.cpp | 5 +++++ src/engine/platform/ym2610.cpp | 6 ++++++ src/engine/platform/ym2610ext.cpp | 5 +++++ src/gui/insEdit.cpp | 20 ++++++++++++++++++++ 7 files changed, 54 insertions(+) diff --git a/src/engine/platform/arcade.cpp b/src/engine/platform/arcade.cpp index 3c5c68a1a..328a8401c 100644 --- a/src/engine/platform/arcade.cpp +++ b/src/engine/platform/arcade.cpp @@ -619,10 +619,12 @@ int DivPlatformArcade::dispatch(DivCommand c) { } } chan[c.chan].keyOff=true; + chan[c.chan].keyOn=false; chan[c.chan].active=false; break; case DIV_CMD_NOTE_OFF_ENV: chan[c.chan].keyOff=true; + chan[c.chan].keyOn=false; chan[c.chan].active=false; chan[c.chan].std.release(); break; @@ -851,6 +853,10 @@ void DivPlatformArcade::forceIns() { rWrite(chanOffs[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)|((chan[i].chVolL&1)<<6)|((chan[i].chVolR&1)<<7)); } rWrite(chanOffs[i]+ADDR_FMS_AMS,((chan[i].state.fms&7)<<4)|(chan[i].state.ams&3)); + if (chan[i].active) { + chan[i].keyOn=true; + chan[i].freqChanged=true; + } } for (int i=8; i<13; i++) { chan[i].insChanged=true; diff --git a/src/engine/platform/c64.cpp b/src/engine/platform/c64.cpp index 505f049a6..07902e1fd 100644 --- a/src/engine/platform/c64.cpp +++ b/src/engine/platform/c64.cpp @@ -258,11 +258,13 @@ int DivPlatformC64::dispatch(DivCommand c) { case DIV_CMD_NOTE_OFF: chan[c.chan].active=false; chan[c.chan].keyOff=true; + chan[c.chan].keyOn=false; //chan[c.chan].std.init(NULL); break; case DIV_CMD_NOTE_OFF_ENV: chan[c.chan].active=false; chan[c.chan].keyOff=true; + chan[c.chan].keyOn=false; chan[c.chan].std.release(); break; case DIV_CMD_ENV_RELEASE: @@ -439,6 +441,10 @@ void DivPlatformC64::forceIns() { for (int i=0; i<3; i++) { chan[i].insChanged=true; chan[i].testWhen=0; + if (chan[i].active) { + chan[i].keyOn=true; + chan[i].freqChanged=true; + } } updateFilter(); } diff --git a/src/engine/platform/genesis.cpp b/src/engine/platform/genesis.cpp index 8787d0552..27b3df450 100644 --- a/src/engine/platform/genesis.cpp +++ b/src/engine/platform/genesis.cpp @@ -578,6 +578,7 @@ int DivPlatformGenesis::dispatch(DivCommand c) { if (dumpWrites) addWrite(0xffff0002,0); } chan[c.chan].keyOff=true; + chan[c.chan].keyOn=false; chan[c.chan].active=false; break; case DIV_CMD_NOTE_OFF_ENV: @@ -586,6 +587,7 @@ int DivPlatformGenesis::dispatch(DivCommand c) { if (dumpWrites) addWrite(0xffff0002,0); } chan[c.chan].keyOff=true; + chan[c.chan].keyOn=false; chan[c.chan].active=false; chan[c.chan].std.release(); break; @@ -781,6 +783,10 @@ void DivPlatformGenesis::forceIns() { } rWrite(chanOffs[i]+ADDR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)); rWrite(chanOffs[i]+ADDR_LRAF,(isMuted[i]?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4)); + if (chan[i].active) { + chan[i].keyOn=true; + chan[i].freqChanged=true; + } } if (dacMode) { rWrite(0x2b,0x80); diff --git a/src/engine/platform/genesisext.cpp b/src/engine/platform/genesisext.cpp index 382c89f53..364505db2 100644 --- a/src/engine/platform/genesisext.cpp +++ b/src/engine/platform/genesisext.cpp @@ -81,6 +81,7 @@ int DivPlatformGenesisExt::dispatch(DivCommand c) { } case DIV_CMD_NOTE_OFF: opChan[ch].keyOff=true; + opChan[ch].keyOn=false; opChan[ch].active=false; break; case DIV_CMD_VOLUME: { @@ -315,6 +316,10 @@ void DivPlatformGenesisExt::forceIns() { DivPlatformGenesis::forceIns(); for (int i=0; i<4; i++) { opChan[i].insChanged=true; + if (opChan[i].active) { + opChan[i].keyOn=true; + opChan[i].freqChanged=true; + } } } diff --git a/src/engine/platform/ym2610.cpp b/src/engine/platform/ym2610.cpp index 135e73fef..c51ad1f26 100644 --- a/src/engine/platform/ym2610.cpp +++ b/src/engine/platform/ym2610.cpp @@ -515,6 +515,7 @@ int DivPlatformYM2610::dispatch(DivCommand c) { break; } chan[c.chan].keyOff=true; + chan[c.chan].keyOn=false; chan[c.chan].active=false; chan[c.chan].std.init(NULL); break; @@ -528,6 +529,7 @@ int DivPlatformYM2610::dispatch(DivCommand c) { break; } chan[c.chan].keyOff=true; + chan[c.chan].keyOn=false; chan[c.chan].active=false; chan[c.chan].std.release(); break; @@ -829,6 +831,10 @@ void DivPlatformYM2610::forceIns() { } rWrite(chanOffs[i]+ADDR_FB_ALG,(chan[i].state.alg&7)|(chan[i].state.fb<<3)); rWrite(chanOffs[i]+ADDR_LRAF,(isMuted[i]?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4)); + if (chan[i].active) { + chan[i].keyOn=true; + chan[i].freqChanged=true; + } } for (int i=4; i<14; i++) { chan[i].insChanged=true; diff --git a/src/engine/platform/ym2610ext.cpp b/src/engine/platform/ym2610ext.cpp index 1cd17945b..000ab69da 100644 --- a/src/engine/platform/ym2610ext.cpp +++ b/src/engine/platform/ym2610ext.cpp @@ -71,6 +71,7 @@ int DivPlatformYM2610Ext::dispatch(DivCommand c) { } case DIV_CMD_NOTE_OFF: opChan[ch].keyOff=true; + opChan[ch].keyOn=false; opChan[ch].active=false; break; case DIV_CMD_VOLUME: { @@ -282,6 +283,10 @@ void DivPlatformYM2610Ext::forceIns() { DivPlatformYM2610::forceIns(); for (int i=0; i<4; i++) { opChan[i].insChanged=true; + if (opChan[i].active) { + opChan[i].keyOn=true; + opChan[i].freqChanged=true; + } } } diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index 66e18f9b9..7953510b7 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -62,6 +62,26 @@ const char* fmParamNames[3][16]={ {"ALG", "FB", "FMS/PMS", "AMS", "AR", "DR", "D2R", "RR", "SL", "TL", "RS", "MULT", "DT", "DT2", "SSG-EG", "AM"} }; +const char* opllInsNames[18]={ + "User", + "Violin", + "Guitar", + "Piano", + "Flute", + "Clarinet", + "Oboe", + "Trumpet", + "Organ", + "Horn", + "Synth", + "Harpsichord", + "Vibraphone", + "Synth Bass", + "Acoustic Bass", + "Electric Guitar", + "Drums (compatibility only!)" +}; + enum FMParams { FM_ALG=0, FM_FB=1,