From 9d410dfe9cd5b4c416d709604065a9c1ca73f58e Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 7 Aug 2023 18:05:31 -0500 Subject: [PATCH] add isVolGlobal to DivDispatch do not key release on pendingNotes if so issue #1325 --- src/engine/dispatch.h | 6 ++++++ src/engine/platform/abstract.cpp | 4 ++++ src/engine/platform/c64.cpp | 4 ++++ src/engine/platform/c64.h | 1 + src/engine/platform/ted.cpp | 4 ++++ src/engine/platform/ted.h | 1 + src/engine/platform/vic20.cpp | 4 ++++ src/engine/platform/vic20.h | 1 + src/engine/playback.cpp | 2 +- 9 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/engine/dispatch.h b/src/engine/dispatch.h index acd0cc77b..875ff487d 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 82694e003..2be22d1f4 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 6ca85ffe0..15ff00d92 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 0da59fc83..def32eaab 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 be5a379e7..a1e431bb4 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 25c41e3d8..58b4d0b7d 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 bd25b5284..05705f7c7 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 e233d9844..b1c1533ab 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 544d59250..d15933d65 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));