diff --git a/src/sfizz/Config.h b/src/sfizz/Config.h index ac25d3e5..89a44e09 100644 --- a/src/sfizz/Config.h +++ b/src/sfizz/Config.h @@ -172,6 +172,12 @@ namespace config { * and the voice will release itself at the end of the decay stage. */ constexpr float sustainFreeRunningThreshold { 0.0032f }; + /** + * @brief Number of frames offset between the end of a block and the beginning of the next + * detected as a shift in the playhead position + * + */ + constexpr int playheadMovedFrames { 16 }; } // namespace config } // namespace sfz diff --git a/src/sfizz/Synth.cpp b/src/sfizz/Synth.cpp index d94aba30..95e588de 100644 --- a/src/sfizz/Synth.cpp +++ b/src/sfizz/Synth.cpp @@ -1316,7 +1316,7 @@ void Synth::timePosition(int delay, int bar, double barBeat) const auto newBeatPosition = newPosition.toBeats(impl.resources_.beatClock.getTimeSignature()); const auto currentBeatPosition = impl.resources_.beatClock.getLastBeatPosition(); const auto positionDifference = std::abs(newBeatPosition - currentBeatPosition); - const auto threshold = 2 * impl.resources_.beatClock.getBeatsPerFrame(); + const auto threshold = config::playheadMovedFrames * impl.resources_.beatClock.getBeatsPerFrame(); if (positionDifference > threshold) impl.playheadMoved_ = true;