fix a silly bug

TODO: apparently this song requires accurate porta...
This commit is contained in:
tildearrow 2021-05-19 03:09:51 -05:00
parent f26307f11b
commit 79f15fcbd8
2 changed files with 8 additions and 4 deletions

View file

@ -18,7 +18,7 @@ struct DivChannelState {
int vibratoDepth, vibratoRate, vibratoPos, vibratoDir, vibratoFine; int vibratoDepth, vibratoRate, vibratoPos, vibratoDir, vibratoFine;
int tremoloDepth, tremoloRate, tremoloPos; int tremoloDepth, tremoloRate, tremoloPos;
unsigned char arp, arpStage, arpTicks; unsigned char arp, arpStage, arpTicks;
bool doNote, legato, portaStop, keyOn; bool doNote, legato, portaStop, keyOn, nowYouCanStop;
DivChannelState(): DivChannelState():
note(-1), note(-1),
@ -40,7 +40,7 @@ struct DivChannelState {
arp(0), arp(0),
arpStage(-1), arpStage(-1),
arpTicks(1), arpTicks(1),
doNote(false), legato(false), portaStop(false), keyOn(false) {} doNote(false), legato(false), portaStop(false), keyOn(false), nowYouCanStop(true) {}
}; };
class DivEngine { class DivEngine {

View file

@ -222,7 +222,8 @@ void DivEngine::processRow(int i, bool afterDelay) {
} else { } else {
chan[i].portaNote=0x00; chan[i].portaNote=0x00;
chan[i].portaSpeed=effectVal; chan[i].portaSpeed=effectVal;
chan[i].portaStop=false; chan[i].portaStop=true;
chan[i].nowYouCanStop=false;
} }
break; break;
case 0x03: // portamento case 0x03: // portamento
@ -267,11 +268,13 @@ void DivEngine::processRow(int i, bool afterDelay) {
chan[i].portaNote=chan[i].note+(effectVal&15); chan[i].portaNote=chan[i].note+(effectVal&15);
chan[i].portaSpeed=(effectVal>>4)*4; chan[i].portaSpeed=(effectVal>>4)*4;
chan[i].portaStop=true; chan[i].portaStop=true;
chan[i].nowYouCanStop=false;
break; break;
case 0xe2: // portamento down case 0xe2: // portamento down
chan[i].portaNote=chan[i].note-(effectVal&15); chan[i].portaNote=chan[i].note-(effectVal&15);
chan[i].portaSpeed=(effectVal>>4)*4; chan[i].portaSpeed=(effectVal>>4)*4;
chan[i].portaStop=true; chan[i].portaStop=true;
chan[i].nowYouCanStop=false;
break; break;
case 0xe3: // vibrato direction case 0xe3: // vibrato direction
chan[i].vibratoDir=effectVal; chan[i].vibratoDir=effectVal;
@ -305,13 +308,14 @@ void DivEngine::processRow(int i, bool afterDelay) {
} }
chan[i].doNote=false; chan[i].doNote=false;
if (!chan[i].keyOn) { if (!chan[i].keyOn) {
if (chan[i].portaStop) { if (chan[i].portaStop && chan[i].nowYouCanStop) {
chan[i].portaNote=-1; chan[i].portaNote=-1;
chan[i].portaSpeed=-1; chan[i].portaSpeed=-1;
} }
} }
chan[i].keyOn=true; chan[i].keyOn=true;
} }
chan[i].nowYouCanStop=true;
// post effects // post effects
for (int j=0; j<song.pat[i]->effectRows; j++) { for (int j=0; j<song.pat[i]->effectRows; j++) {