improve 03xx accuracy

portamento stops if same note
This commit is contained in:
tildearrow 2021-12-19 00:02:48 -05:00
parent 2cb7152c06
commit 97a00c7efd
2 changed files with 12 additions and 3 deletions

View File

@ -23,7 +23,7 @@ enum DivAudioEngines {
struct DivChannelState {
std::vector<DivDelayedCommand> delayed;
int note, pitch, portaSpeed, portaNote;
int note, oldNote, pitch, portaSpeed, portaNote;
int volume, volSpeed, cut, rowDelay, volMax;
int delayOrder, delayRow;
int vibratoDepth, vibratoRate, vibratoPos, vibratoDir, vibratoFine;
@ -33,6 +33,7 @@ struct DivChannelState {
DivChannelState():
note(-1),
oldNote(-1),
pitch(0),
portaSpeed(-1),
portaNote(-1),

View File

@ -348,6 +348,7 @@ void DivEngine::processRow(int i, bool afterDelay) {
}
dispatchCmd(DivCommand(DIV_CMD_NOTE_OFF,i));
} else if (!(pat->data[whatRow][0]==0 && pat->data[whatRow][1]==0)) {
chan[i].oldNote=chan[i].note;
chan[i].note=pat->data[whatRow][0]+pat->data[whatRow][1]*12;
if (!chan[i].keyOn) {
if (dispatch->keyOffAffectsArp(i)) {
@ -428,8 +429,13 @@ void DivEngine::processRow(int i, bool afterDelay) {
chan[i].portaSpeed=-1;
dispatchCmd(DivCommand(DIV_CMD_PRE_PORTA,i,false));
} else {
chan[i].portaNote=chan[i].note;
chan[i].portaSpeed=effectVal;
if (chan[i].note==chan[i].oldNote) {
chan[i].portaNote=chan[i].note;
chan[i].portaSpeed=0;
} else {
chan[i].portaNote=chan[i].note;
chan[i].portaSpeed=effectVal;
}
chan[i].portaStop=true;
chan[i].doNote=false;
chan[i].stopOnOff=true;
@ -727,12 +733,14 @@ bool DivEngine::nextTick() {
if (chan[i].portaSpeed>0) {
if (dispatchCmd(DivCommand(DIV_CMD_NOTE_PORTA,i,chan[i].portaSpeed,chan[i].portaNote))==2 && chan[i].portaStop) {
chan[i].portaSpeed=0;
chan[i].oldNote=chan[i].note;
chan[i].note=chan[i].portaNote;
dispatchCmd(DivCommand(DIV_CMD_LEGATO,i,chan[i].note));
}
}
if (chan[i].cut>0) {
if (--chan[i].cut<1) {
chan[i].oldNote=chan[i].note;
chan[i].note=-1;
dispatchCmd(DivCommand(DIV_CMD_NOTE_OFF,i));
}