Thanks a ton. My function collapsed down to:
// pitch_cv_input should range from -1 to 1 for 2 octaves,
// -2.0 to 2.0 for four octaves, -3.0 to 3.0 for six octaves, etc.
double getSampleIncrement(float pitch_cv_input)
{
return(step_amount * exp2(pitch_cv_input));
}
I compute this->step_amount
only when the sample rate changes, using code like this:
void onSampleRateChange(const SampleRateChangeEvent& e) override
{
step_amount = wav_sample_rate / APP->engine->getSampleRate();
}
So far, so good!