add isVolGlobal to DivDispatch

do not key release on pendingNotes if so
issue #1325
This commit is contained in:
tildearrow 2023-08-07 18:05:31 -05:00
parent 10ecc71a60
commit 9d410dfe9c
9 changed files with 26 additions and 1 deletions

View file

@ -485,6 +485,12 @@ class DivDispatch {
*/ */
virtual bool keyOffAffectsPorta(int ch); virtual bool keyOffAffectsPorta(int ch);
/**
* test whether volume is global.
* @return whether it is.
*/
virtual bool isVolGlobal();
/** /**
* get the lowest note in a portamento. * get the lowest note in a portamento.
* @param ch the channel in question. * @param ch the channel in question.

View file

@ -86,6 +86,10 @@ bool DivDispatch::keyOffAffectsPorta(int ch) {
return false; return false;
} }
bool DivDispatch::isVolGlobal() {
return false;
}
int DivDispatch::getPortaFloor(int ch) { int DivDispatch::getPortaFloor(int ch) {
return 0x00; return 0x00;
} }

View file

@ -566,6 +566,10 @@ bool DivPlatformC64::getWantPreNote() {
return true; return true;
} }
bool DivPlatformC64::isVolGlobal() {
return true;
}
float DivPlatformC64::getPostAmp() { float DivPlatformC64::getPostAmp() {
return (sidCore==1)?3.0f:1.0f; return (sidCore==1)?3.0f:1.0f;
} }

View file

@ -105,6 +105,7 @@ class DivPlatformC64: public DivDispatch {
void notifyInsChange(int ins); void notifyInsChange(int ins);
bool getDCOffRequired(); bool getDCOffRequired();
bool getWantPreNote(); bool getWantPreNote();
bool isVolGlobal();
float getPostAmp(); float getPostAmp();
DivMacroInt* getChanMacroInt(int ch); DivMacroInt* getChanMacroInt(int ch);
void notifyInsDeletion(void* ins); void notifyInsDeletion(void* ins);

View file

@ -257,6 +257,10 @@ void DivPlatformTED::forceIns() {
updateCtrl=true; updateCtrl=true;
} }
bool DivPlatformTED::isVolGlobal() {
return true;
}
void* DivPlatformTED::getChanState(int ch) { void* DivPlatformTED::getChanState(int ch) {
return &chan[ch]; return &chan[ch];
} }

View file

@ -54,6 +54,7 @@ class DivPlatformTED: public DivDispatch {
public: public:
void acquire(short** buf, size_t len); void acquire(short** buf, size_t len);
int dispatch(DivCommand c); int dispatch(DivCommand c);
bool isVolGlobal();
void* getChanState(int chan); void* getChanState(int chan);
DivMacroInt* getChanMacroInt(int ch); DivMacroInt* getChanMacroInt(int ch);
DivDispatchOscBuffer* getOscBuffer(int chan); DivDispatchOscBuffer* getOscBuffer(int chan);

View file

@ -278,6 +278,10 @@ void DivPlatformVIC20::forceIns() {
} }
} }
bool DivPlatformVIC20::isVolGlobal() {
return true;
}
void* DivPlatformVIC20::getChanState(int ch) { void* DivPlatformVIC20::getChanState(int ch) {
return &chan[ch]; return &chan[ch];
} }

View file

@ -46,6 +46,7 @@ class DivPlatformVIC20: public DivDispatch {
public: public:
void acquire(short** buf, size_t len); void acquire(short** buf, size_t len);
int dispatch(DivCommand c); int dispatch(DivCommand c);
bool isVolGlobal();
void* getChanState(int chan); void* getChanState(int chan);
DivMacroInt* getChanMacroInt(int ch); DivMacroInt* getChanMacroInt(int ch);
DivDispatchOscBuffer* getOscBuffer(int chan); DivDispatchOscBuffer* getOscBuffer(int chan);

View file

@ -1307,7 +1307,7 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) {
} else { } else {
DivMacroInt* macroInt=disCont[dispatchOfChan[note.channel]].dispatch->getChanMacroInt(dispatchChanOfChan[note.channel]); DivMacroInt* macroInt=disCont[dispatchOfChan[note.channel]].dispatch->getChanMacroInt(dispatchChanOfChan[note.channel]);
if (macroInt!=NULL) { if (macroInt!=NULL) {
if (macroInt->hasRelease) { if (macroInt->hasRelease && !disCont[dispatchOfChan[note.channel]].dispatch->isVolGlobal()) {
dispatchCmd(DivCommand(DIV_CMD_NOTE_OFF_ENV,note.channel)); dispatchCmd(DivCommand(DIV_CMD_NOTE_OFF_ENV,note.channel));
} else { } else {
dispatchCmd(DivCommand(DIV_CMD_NOTE_OFF,note.channel)); dispatchCmd(DivCommand(DIV_CMD_NOTE_OFF,note.channel));