dsp::ProcessorChain

Hi, is there a dynamic version of this where I can add and remove dsp processors in real-time, or should I just write code to call separate processors in the order I need them?

thx

I wrote a dynamic version that holds a various number of processors of the same type for our in-house codebase.

But writing a dynamic chain that takes any type of processor is nearly impossible. DSP module compatible processors are not necessarily derived from a base class. There is the dsp::ProcessorBase class, however it defines a processor taking a dsp::ProcessContextReplacing<float> as process context type. But most JUCE processors don’t inherit that class and define a templated process function with the type of process context being a template type. So building a dynamic chain that takes every type of processor by using something like an OwnedArray<dsp::ProcessorBase> to store processors won’t work. What works well is to add such a dynamic chain as a sub-processor to the libraries compile time fixed chain, which allows e.g. dynamically adding chained filters.

What’s your exact use-case?

1 Like

hi - thx for the reply.

Use case is to have fx such as delay, reverb, chorus, phaser etc. and to be able to enable/disable them and determine the order they operate in.

Enabling/disabling can be achieved by setting the chain elements bypassed, but reordering is not possible for the reasons explained above. The main goal of the chain is that it can be heavily optimized in a release build, but therefore the fixed order of the processors is needed.

Never worked with it myself, but the AudioProcessorGraph is the tool of choice for dynamic processing chains. But it’s not as lightweight as the chain.

1 Like

thx - will check that out.

Where should you call setBypassed on individual elements of the chain? Nothing I’ve tried has worked.