From c46d659340525f963c95a58747d06deabac9bd9b Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 12 May 2022 09:32:11 +0100 Subject: [PATCH] Fix transport reset logic for hosts with non-static buffer sizes --- src/CardinalPlugin.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CardinalPlugin.cpp b/src/CardinalPlugin.cpp index b53e81d..a4c56ca 100644 --- a/src/CardinalPlugin.cpp +++ b/src/CardinalPlugin.cpp @@ -448,7 +448,7 @@ class CardinalPlugin : public CardinalBasePlugin #endif std::string fAutosavePath; - uint64_t fPreviousFrame; + uint64_t fNextExpectedFrame; struct { String comment; @@ -474,7 +474,7 @@ public: #if DISTRHO_PLUGIN_NUM_INPUTS != 0 fAudioBufferCopy(nullptr), #endif - fPreviousFrame(0), + fNextExpectedFrame(0), fWasBypassed(false) { #ifndef HEADLESS @@ -1082,7 +1082,7 @@ protected: fAudioBufferCopy[i] = new float[bufferSize]; #endif - fPreviousFrame = 0; + fNextExpectedFrame = 0; } void deactivate() override @@ -1108,7 +1108,7 @@ protected: { const TimePosition& timePos(getTimePosition()); - const bool reset = timePos.playing && (timePos.frame == 0 || fPreviousFrame + frames != timePos.frame); + const bool reset = timePos.playing && (timePos.frame == 0 || fNextExpectedFrame != timePos.frame); context->playing = timePos.playing; context->bbtValid = timePos.bbt.valid; @@ -1133,7 +1133,7 @@ protected: } context->reset = reset; - fPreviousFrame = timePos.frame; + fNextExpectedFrame = timePos.playing ? timePos.frame + frames : 0; } // separate buffers, use them