diff --git a/src/engine/platform/gb.cpp b/src/engine/platform/gb.cpp index 222191f6c..3b9d2d2c6 100644 --- a/src/engine/platform/gb.cpp +++ b/src/engine/platform/gb.cpp @@ -308,7 +308,9 @@ int DivPlatformGB::dispatch(DivCommand c) { chan[c.chan].note=c.value; break; case DIV_CMD_PRE_PORTA: - chan[c.chan].std.init(parent->getIns(chan[c.chan].ins)); + if (chan[c.chan].active) { + chan[c.chan].std.init(parent->getIns(chan[c.chan].ins)); + } chan[c.chan].inPorta=c.value; break; case DIV_CMD_GB_SWEEP_DIR: diff --git a/src/engine/platform/sms.cpp b/src/engine/platform/sms.cpp index e1c806770..ed0838038 100644 --- a/src/engine/platform/sms.cpp +++ b/src/engine/platform/sms.cpp @@ -33,14 +33,16 @@ void DivPlatformSMS::tick() { rWrite(0x90|(i<<5)|(isMuted[i]?15:(15-(chan[i].outVol&15)))); } if (chan[i].std.hadArp) { - if (chan[i].std.arpMode) { - chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp); - chan[i].actualNote=chan[i].std.arp; - } else { - chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp); - chan[i].actualNote=chan[i].note+chan[i].std.arp; + if (!chan[i].inPorta) { + if (chan[i].std.arpMode) { + chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp); + chan[i].actualNote=chan[i].std.arp; + } else { + chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp); + chan[i].actualNote=chan[i].note+chan[i].std.arp; + } + chan[i].freqChanged=true; } - chan[i].freqChanged=true; } else { if (chan[i].std.arpMode && chan[i].std.finishedArp) { chan[i].baseFreq=NOTE_PERIODIC(chan[i].note); @@ -163,7 +165,10 @@ int DivPlatformSMS::dispatch(DivCommand c) { } } chan[c.chan].freqChanged=true; - if (return2) return 2; + if (return2) { + chan[c.chan].inPorta=false; + return 2; + } break; } case DIV_CMD_STD_NOISE_MODE: @@ -178,6 +183,7 @@ int DivPlatformSMS::dispatch(DivCommand c) { break; case DIV_CMD_PRE_PORTA: chan[c.chan].std.init(parent->getIns(chan[c.chan].ins)); + chan[c.chan].inPorta=c.value; break; case DIV_CMD_GET_VOLMAX: return 15; diff --git a/src/engine/platform/sms.h b/src/engine/platform/sms.h index 5eced7ed6..85af1a18c 100644 --- a/src/engine/platform/sms.h +++ b/src/engine/platform/sms.h @@ -9,7 +9,7 @@ class DivPlatformSMS: public DivDispatch { struct Channel { int freq, baseFreq, pitch, note, actualNote; unsigned char ins; - bool active, insChanged, freqChanged, keyOn, keyOff; + bool active, insChanged, freqChanged, keyOn, keyOff, inPorta; signed char vol, outVol; DivMacroInt std; Channel(): @@ -24,6 +24,7 @@ class DivPlatformSMS: public DivDispatch { freqChanged(false), keyOn(false), keyOff(false), + inPorta(false), vol(15), outVol(15) {} }; diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 0232735ac..e8383d8d9 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -551,6 +551,7 @@ void DivEngine::processRow(int i, bool afterDelay) { chan[i].portaNote=-1; chan[i].portaSpeed=-1; chan[i].inPorta=false; + dispatchCmd(DivCommand(DIV_CMD_PRE_PORTA,i,false)); } else { chan[i].portaNote=song.limitSlides?disCont[dispatchOfChan[i]].dispatch->getPortaFloor(dispatchChanOfChan[i]):-60; chan[i].portaSpeed=effectVal; @@ -559,6 +560,7 @@ void DivEngine::processRow(int i, bool afterDelay) { chan[i].stopOnOff=false; chan[i].scheduledSlideReset=false; chan[i].inPorta=false; + dispatchCmd(DivCommand(DIV_CMD_PRE_PORTA,i,true)); } break; case 0x03: // portamento