JUCE 6 DelayLine processor

Hello, I am playing around with the new DSP modules from JUCE 6. I am trying to set the maxDelayTime using the explicit constructor of the DelayLine class, but with no avail. I don’t understand how to instantiate a templated explicit constructor.

Here are the constructors for the DelayLine

template <typename SampleType, typename InterpolationType = DelayLineInterpolationTypes::Linear>
class DelayLine
{
public:
    
    /** Default constructor. */
    DelayLine();

    /** Constructor. */
    explicit DelayLine (int maximumDelayInSamples);

I am doing this in a processorChain. I’ve never used an explicit constructor before, so the concept is a bit foggy. Couple that with instantiation within a processor chain as well as a templated type and I’m totally confused.

I am committed to JUCE 6 and I know I could accomplish this without the new DelayLine class, so I am really only interested in figuring this particular situation out.

Any help would be appreciated!

explicit just means you can’t use the constructor for implicit conversions. For example:

void someFunction (const DelayLine<float>& delay) ;
// ...
int a = 500;
someFunction(a); // error
someFunction(500); // error
someFunction(DelayLine<float>(a)); // ok
someFunction(DelayLine<float>(500)); // ok
DelayLine<float> delay = 500; // error
DelayLine<float> delay{ 500 }; // ok
someFunction(delay); // ok
1 Like

This is not very pretty but it does compile :

dsp::ProcessorChain<dsp::DelayLine<float>,dsp::Panner<float>> chain;
// to reset the maximum delay time, 
// assign a new instance of the DelayLine at the chain position 0
chain.get<0>() = dsp::DelayLine<float>(10 * 44100);
1 Like

I can’t tell you how much each example you gave helped. Thank you!

Thank you, great to hear from one of the royalty of JUCE