diff --git a/dpf b/dpf index e363552..f0c1692 160000 --- a/dpf +++ b/dpf @@ -1 +1 @@ -Subproject commit e36355245414223d499421a87d88d8aef0b1078b +Subproject commit f0c16920f5a62300f5197b6a339dbc5fec12a882 diff --git a/src/CardinalPlugin.cpp b/src/CardinalPlugin.cpp index 0511cb7..5cb0699 100644 --- a/src/CardinalPlugin.cpp +++ b/src/CardinalPlugin.cpp @@ -81,6 +81,13 @@ namespace window { START_NAMESPACE_DISTRHO +template +static inline +bool d_isDiffHigherThanLimit(const T& v1, const T& v2, const T& limit) +{ + return v1 != v2 ? (v1 > v2 ? v1 - v2 : v2 - v1) > limit : false; +} + // ----------------------------------------------------------------------------------------------------------- struct Initializer @@ -1117,7 +1124,7 @@ protected: { const TimePosition& timePos(getTimePosition()); - const bool reset = timePos.playing && (timePos.frame == 0 || fNextExpectedFrame != timePos.frame); + const bool reset = timePos.playing && (timePos.frame == 0 || d_isDiffHigherThanLimit(fNextExpectedFrame, timePos.frame, (uint64_t)2)); context->playing = timePos.playing; context->bbtValid = timePos.bbt.valid;