further improve the accuracy of 03xx

This commit is contained in:
tildearrow 2021-12-19 00:27:04 -05:00
parent 97a00c7efd
commit 667526e414
2 changed files with 11 additions and 5 deletions

View file

@ -29,7 +29,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, nowYouCanStop, stopOnOff, arpYield, delayLocked; bool doNote, legato, portaStop, keyOn, nowYouCanStop, stopOnOff, arpYield, delayLocked, inPorta;
DivChannelState(): DivChannelState():
note(-1), note(-1),
@ -62,7 +62,8 @@ struct DivChannelState {
nowYouCanStop(true), nowYouCanStop(true),
stopOnOff(false), stopOnOff(false),
arpYield(false), arpYield(false),
delayLocked(false) {} delayLocked(false),
inPorta(false) {}
}; };
class DivEngine { class DivEngine {

View file

@ -403,6 +403,7 @@ void DivEngine::processRow(int i, bool afterDelay) {
if (effectVal==0) { if (effectVal==0) {
chan[i].portaNote=-1; chan[i].portaNote=-1;
chan[i].portaSpeed=-1; chan[i].portaSpeed=-1;
chan[i].inPorta=false;
} else { } else {
chan[i].portaNote=0x60; chan[i].portaNote=0x60;
chan[i].portaSpeed=effectVal; chan[i].portaSpeed=effectVal;
@ -415,6 +416,7 @@ void DivEngine::processRow(int i, bool afterDelay) {
if (effectVal==0) { if (effectVal==0) {
chan[i].portaNote=-1; chan[i].portaNote=-1;
chan[i].portaSpeed=-1; chan[i].portaSpeed=-1;
chan[i].inPorta=false;
} else { } else {
chan[i].portaNote=0x00; chan[i].portaNote=0x00;
chan[i].portaSpeed=effectVal; chan[i].portaSpeed=effectVal;
@ -427,17 +429,19 @@ void DivEngine::processRow(int i, bool afterDelay) {
if (effectVal==0) { if (effectVal==0) {
chan[i].portaNote=-1; chan[i].portaNote=-1;
chan[i].portaSpeed=-1; chan[i].portaSpeed=-1;
chan[i].inPorta=false;
dispatchCmd(DivCommand(DIV_CMD_PRE_PORTA,i,false)); dispatchCmd(DivCommand(DIV_CMD_PRE_PORTA,i,false));
} else { } else {
if (chan[i].note==chan[i].oldNote) { if (chan[i].note==chan[i].oldNote && !chan[i].inPorta) {
chan[i].portaNote=chan[i].note; chan[i].portaNote=chan[i].note;
chan[i].portaSpeed=0; chan[i].portaSpeed=-1;
} else { } else {
chan[i].portaNote=chan[i].note; chan[i].portaNote=chan[i].note;
chan[i].portaSpeed=effectVal; chan[i].portaSpeed=effectVal;
chan[i].inPorta=true;
} }
chan[i].portaStop=true; chan[i].portaStop=true;
chan[i].doNote=false; if (chan[i].keyOn) chan[i].doNote=false;
chan[i].stopOnOff=true; chan[i].stopOnOff=true;
dispatchCmd(DivCommand(DIV_CMD_PRE_PORTA,i,true)); dispatchCmd(DivCommand(DIV_CMD_PRE_PORTA,i,true));
} }
@ -735,6 +739,7 @@ bool DivEngine::nextTick() {
chan[i].portaSpeed=0; chan[i].portaSpeed=0;
chan[i].oldNote=chan[i].note; chan[i].oldNote=chan[i].note;
chan[i].note=chan[i].portaNote; chan[i].note=chan[i].portaNote;
chan[i].inPorta=false;
dispatchCmd(DivCommand(DIV_CMD_LEGATO,i,chan[i].note)); dispatchCmd(DivCommand(DIV_CMD_LEGATO,i,chan[i].note));
} }
} }