Problem
When the host calls prepareToPlay (which happens on sample rate changes), PitchSmoother::prepare() (source/dsp/PitchSmoother.h:8-12) only updates sr and calls recomputeAlpha(). It does NOT reset hasValue or smoothed.
This means stale pitch data from a previous sample rate session persists. The smoother will start from whatever frequency it was tracking before the sample rate change, potentially causing a brief glitch or incorrect modulation frequency.
Note: PluginProcessor::prepareToPlay does reset hasValidPitch = false (line 72), but PitchSmoother's internal state remains stale.
Corroborated by: 3/8 audit agents (param-state, stability-edge, pitch-detection)
Suggested Fix
Add state reset to PitchSmoother::prepare():
void prepare(double sampleRate) {
sr = static_cast<float>(sampleRate);
hasValue = false;
smoothed = 0.0f;
recomputeAlpha();
}
Impact
- Stability: Brief glitch/artifact on sample rate change
- Severity: Medium -- sample rate changes are infrequent but should be handled correctly
Problem
When the host calls
prepareToPlay(which happens on sample rate changes),PitchSmoother::prepare()(source/dsp/PitchSmoother.h:8-12) only updatessrand callsrecomputeAlpha(). It does NOT resethasValueorsmoothed.This means stale pitch data from a previous sample rate session persists. The smoother will start from whatever frequency it was tracking before the sample rate change, potentially causing a brief glitch or incorrect modulation frequency.
Note:
PluginProcessor::prepareToPlaydoes resethasValidPitch = false(line 72), but PitchSmoother's internal state remains stale.Corroborated by: 3/8 audit agents (param-state, stability-edge, pitch-detection)
Suggested Fix
Add state reset to
PitchSmoother::prepare():Impact