Some leeway in frame counting for the playhead moving
This commit is contained in:
parent
ce0a4df29f
commit
ee9170d1a0
2 changed files with 7 additions and 1 deletions
|
|
@ -172,6 +172,12 @@ namespace config {
|
||||||
* and the voice will release itself at the end of the decay stage.
|
* and the voice will release itself at the end of the decay stage.
|
||||||
*/
|
*/
|
||||||
constexpr float sustainFreeRunningThreshold { 0.0032f };
|
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 config
|
||||||
|
|
||||||
} // namespace sfz
|
} // namespace sfz
|
||||||
|
|
|
||||||
|
|
@ -1316,7 +1316,7 @@ void Synth::timePosition(int delay, int bar, double barBeat)
|
||||||
const auto newBeatPosition = newPosition.toBeats(impl.resources_.beatClock.getTimeSignature());
|
const auto newBeatPosition = newPosition.toBeats(impl.resources_.beatClock.getTimeSignature());
|
||||||
const auto currentBeatPosition = impl.resources_.beatClock.getLastBeatPosition();
|
const auto currentBeatPosition = impl.resources_.beatClock.getLastBeatPosition();
|
||||||
const auto positionDifference = std::abs(newBeatPosition - currentBeatPosition);
|
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)
|
if (positionDifference > threshold)
|
||||||
impl.playheadMoved_ = true;
|
impl.playheadMoved_ = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue