Revise the range check of beatPeriod
This commit is contained in:
parent
1d2ffaf430
commit
7ded48b7d4
1 changed files with 2 additions and 2 deletions
|
|
@ -210,7 +210,7 @@ void BeatClock::calculatePhase(float beatPeriod, float* phaseOut)
|
||||||
{
|
{
|
||||||
const unsigned numFrames = currentCycleFrames_;
|
const unsigned numFrames = currentCycleFrames_;
|
||||||
|
|
||||||
if (beatPeriod == 0.0f) {
|
if (beatPeriod <= 0.0f) {
|
||||||
fill(absl::MakeSpan(phaseOut, numFrames), 0.0f);
|
fill(absl::MakeSpan(phaseOut, numFrames), 0.0f);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -236,7 +236,7 @@ void BeatClock::calculatePhaseModulated(const float* beatPeriodData, float* phas
|
||||||
float beatPosition = std::max(0.0f, beatPositionData[i]);
|
float beatPosition = std::max(0.0f, beatPositionData[i]);
|
||||||
float phase = beatPosition / beatPeriod;
|
float phase = beatPosition / beatPeriod;
|
||||||
phase -= static_cast<int>(phase);
|
phase -= static_cast<int>(phase);
|
||||||
phaseOut[i] = (beatPeriod != 0.0f) ? phase : 0.0f;
|
phaseOut[i] = (beatPeriod > 0.0f) ? phase : 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue