diff --git a/src/engine/dispatch.h b/src/engine/dispatch.h index acd0cc77..875ff487 100644 --- a/src/engine/dispatch.h +++ b/src/engine/dispatch.h @@ -485,6 +485,12 @@ class DivDispatch { */ virtual bool keyOffAffectsPorta(int ch); + /** + * test whether volume is global. + * @return whether it is. + */ + virtual bool isVolGlobal(); + /** * get the lowest note in a portamento. * @param ch the channel in question. diff --git a/src/engine/platform/abstract.cpp b/src/engine/platform/abstract.cpp index 82694e00..2be22d1f 100644 --- a/src/engine/platform/abstract.cpp +++ b/src/engine/platform/abstract.cpp @@ -86,6 +86,10 @@ bool DivDispatch::keyOffAffectsPorta(int ch) { return false; } +bool DivDispatch::isVolGlobal() { + return false; +} + int DivDispatch::getPortaFloor(int ch) { return 0x00; } diff --git a/src/engine/platform/c64.cpp b/src/engine/platform/c64.cpp index 6ca85ffe..15ff00d9 100644 --- a/src/engine/platform/c64.cpp +++ b/src/engine/platform/c64.cpp @@ -566,6 +566,10 @@ bool DivPlatformC64::getWantPreNote() { return true; } +bool DivPlatformC64::isVolGlobal() { + return true; +} + float DivPlatformC64::getPostAmp() { return (sidCore==1)?3.0f:1.0f; } diff --git a/src/engine/platform/c64.h b/src/engine/platform/c64.h index 0da59fc8..def32eaa 100644 --- a/src/engine/platform/c64.h +++ b/src/engine/platform/c64.h @@ -105,6 +105,7 @@ class DivPlatformC64: public DivDispatch { void notifyInsChange(int ins); bool getDCOffRequired(); bool getWantPreNote(); + bool isVolGlobal(); float getPostAmp(); DivMacroInt* getChanMacroInt(int ch); void notifyInsDeletion(void* ins); diff --git a/src/engine/platform/ted.cpp b/src/engine/platform/ted.cpp index be5a379e..a1e431bb 100644 --- a/src/engine/platform/ted.cpp +++ b/src/engine/platform/ted.cpp @@ -257,6 +257,10 @@ void DivPlatformTED::forceIns() { updateCtrl=true; } +bool DivPlatformTED::isVolGlobal() { + return true; +} + void* DivPlatformTED::getChanState(int ch) { return &chan[ch]; } diff --git a/src/engine/platform/ted.h b/src/engine/platform/ted.h index 25c41e3d..58b4d0b7 100644 --- a/src/engine/platform/ted.h +++ b/src/engine/platform/ted.h @@ -54,6 +54,7 @@ class DivPlatformTED: public DivDispatch { public: void acquire(short** buf, size_t len); int dispatch(DivCommand c); + bool isVolGlobal(); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); DivDispatchOscBuffer* getOscBuffer(int chan); diff --git a/src/engine/platform/vic20.cpp b/src/engine/platform/vic20.cpp index bd25b528..05705f7c 100644 --- a/src/engine/platform/vic20.cpp +++ b/src/engine/platform/vic20.cpp @@ -278,6 +278,10 @@ void DivPlatformVIC20::forceIns() { } } +bool DivPlatformVIC20::isVolGlobal() { + return true; +} + void* DivPlatformVIC20::getChanState(int ch) { return &chan[ch]; } diff --git a/src/engine/platform/vic20.h b/src/engine/platform/vic20.h index e233d984..b1c1533a 100644 --- a/src/engine/platform/vic20.h +++ b/src/engine/platform/vic20.h @@ -46,6 +46,7 @@ class DivPlatformVIC20: public DivDispatch { public: void acquire(short** buf, size_t len); int dispatch(DivCommand c); + bool isVolGlobal(); void* getChanState(int chan); DivMacroInt* getChanMacroInt(int ch); DivDispatchOscBuffer* getOscBuffer(int chan); diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 544d5925..d15933d6 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -1307,7 +1307,7 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) { } else { DivMacroInt* macroInt=disCont[dispatchOfChan[note.channel]].dispatch->getChanMacroInt(dispatchChanOfChan[note.channel]); if (macroInt!=NULL) { - if (macroInt->hasRelease) { + if (macroInt->hasRelease && !disCont[dispatchOfChan[note.channel]].dispatch->isVolGlobal()) { dispatchCmd(DivCommand(DIV_CMD_NOTE_OFF_ENV,note.channel)); } else { dispatchCmd(DivCommand(DIV_CMD_NOTE_OFF,note.channel));