I know the original plan was to add a delay line to the JUCE DSP module… if you have a simple delay line we could use it for AudioProcessor::processBypassed() to maintain the latency of the processor without having to recalculate the AudioProcessorGraph.
Thanks,
Rail
Please move to Feature Request forum.
Rail
there is this one already there : [FR] fractional delay line
Close… but I want to make sure that AudioProcessor::processBypassed() is part of the FR 
Cheers,
Rail
Would it need to be a fractional delay line, or would a simple delay line not be enough for that purpose?
Since setLatencySamples() should probably not be called during processing, there would be no problem to initialise the delay line to the proper length once setLatencySamples() is called?
1 Like
This request is for a Simple Delay Line and for it to be used in AudioProcessor::processBypassed().
It could be initialized in prepareToPlay() or setLatencySamples() to the right length. I think you’re right, setLatencySamples() would probably be better.
The question is if it should be added to the DSP class and make AudioProcessor require the DSP module or add it to the juce_audio_processors module?
Rail
That’s what I thought. Was just confused by the link to the fractional delay FR, so I agree, those should be treated individually, since a fractional delay line would a) be overkill and b) delays this FR, since it is more complicated.
Thank you for clarifying.
Since it is not “really DSP” but simply copying samples, I think it doesn’t need to be in the juce_dsp.
Also since it might lead to allocation (suddenly setting a long latency), I also think it’s best setup in prepareToPlay, ignoring the fact, that theoretically setLatencySamples() could be called somewhere else.
3 Likes
Well I implemented this in my local copy of JUCE for my project… you can’t add the delay initialization to prepareToPlay() because it’s a pure virtual function… so I created a separate AudioProcessor::prepareBypassDelay() method… and I call that from my AudioProcessorGraph:
void AudioProcessorGraph::Node::setBypassed (bool shouldBeBypassed) noexcept
{
if (processor != nullptr)
{
if (auto* bypassParam = processor->getBypassParameter())
bypassParam->setValueNotifyingHost (shouldBeBypassed ? 1.0f : 0.0f);
if (shouldBeBypassed)
processor->prepareBypassDelay();
}
bypassed = shouldBeBypassed;
}
and in AudioProcessor::processBypassed() I delay the buffer by latencySamples.
Rail