From 7ded48b7d436fd4c1f5b1d7812e99089706d1b7e Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sun, 15 Nov 2020 14:38:05 +0100 Subject: [PATCH] Revise the range check of beatPeriod --- src/sfizz/BeatClock.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sfizz/BeatClock.cpp b/src/sfizz/BeatClock.cpp index 126c6ca6..70ef5856 100644 --- a/src/sfizz/BeatClock.cpp +++ b/src/sfizz/BeatClock.cpp @@ -210,7 +210,7 @@ void BeatClock::calculatePhase(float beatPeriod, float* phaseOut) { const unsigned numFrames = currentCycleFrames_; - if (beatPeriod == 0.0f) { + if (beatPeriod <= 0.0f) { fill(absl::MakeSpan(phaseOut, numFrames), 0.0f); return; } @@ -236,7 +236,7 @@ void BeatClock::calculatePhaseModulated(const float* beatPeriodData, float* phas float beatPosition = std::max(0.0f, beatPositionData[i]); float phase = beatPosition / beatPeriod; phase -= static_cast(phase); - phaseOut[i] = (beatPeriod != 0.0f) ? phase : 0.0f; + phaseOut[i] = (beatPeriod > 0.0f) ? phase : 0.0f; } }