Hello, when attempting to run a delay plugin that relies on JUCE’s delay line class, I receive the following error message: JUCE Assertion failure in juce_DelayLine.cpp:60
For reference, here are some relevant lines of juce_DelayLine.cpp:
void DelayLine<SampleType, InterpolationType>::setDelay (SampleType newDelayInSamples)
{
auto upperLimit = (SampleType) getMaximumDelayInSamples();
jassert (isPositiveAndNotGreaterThan (newDelayInSamples, upperLimit)); // Line 60
delay = jlimit ((SampleType) 0, upperLimit, newDelayInSamples);
delayInt = static_cast<int> (std::floor (delay));
delayFrac = delay - (SampleType) delayInt;
updateInternalVariables();
}
In my code, delay is an AudioParameterFloat that ranges from 0.001f to 1.0f, and prepareToPlay is as follows:
void prepareToPlay (double sampleRate, int samplesPerBlock) override
{
juce::dsp::ProcessSpec spec;
spec.maximumBlockSize = samplesPerBlock;
spec.sampleRate = sampleRate;
spec.numChannels = getTotalNumOutputChannels();
delayLine.prepare (spec);
// Delay in seconds is converted to delay in samples
delayLine.setDelay (delay->get() * sampleRate);
// Since the delay parameter is limited to a maximum of 1s, the maximum possible delay in samples is sampleRate in samples/s * 1s
delayLine.setMaximumDelayInSamples (sampleRate);
}
I also tried hard coding int, double, and float values for both setDelay and setMaximumDelayInSamples that ensure newDelayInSamples is positive and not greater than upperLimit in reference to juce_DelayLine.cpp line 60 but got the same JUCE assertion failure each time.
