Question about ProcessorChain syntax

I am starting to explore the ProcessorChain - and have one very basic question:

I can add a convolution reverb to a ProcessorChain owned array, written below:

chain.add(new juce::dsp::ProcessorChain < juce::dsp::Convolution>);

But when I try to add it with a fixed latency, I am sure I am missing something, because I get an error

chain.add(new juce::dsp::ProcessorChain < juce::dsp::Convolution(juce::dsp::Convolution::Latency{ lat })>);

When I add it without the latency part, it works, also adding a convolution outside a processorchain as written above -with the latency- also works ok. I am obviously writing this wrong, what’s my problem?

Thanks in advance,

The ProcessorChain doesn’t include a way of passing custom constructor arguments to individual elements in the chain. I think that you’d need to create a custom struct which initialises the convolution in the correct way, and then use that struct in your chain.

struct FixedLatencyConvolution : public juce::dsp::Convolution
{
    static constexpr auto latency = 128;
    FixedLatencyConvolution() : Convolution (juce::dsp::Convolution::Latency { latency }) {}
};
1 Like

Yay works perfectly! Thank you!