AudioProcessorValueTreeState: createAndAddParameter from different modules


Hi everybody !

I would know if there is an elegant way to use createAndAddParameter outside of the AudioProcessor constructor. The idea is to distribute the creation of parameters in the different modules of a synth (for example, the Envelope 1 adds its parameters, then the Envelope 2, then the LFO 1 etc…).

I’ve tried to createAndAddParameter from the editor but it’s impossible to use this method after having initialized the ValueTree of the AudioProcessorValueTreeState.
So I tried to initialize the ValueTree in the Editor. It failed because the Editor is constructed twice. Consequently I added code to ensure that the ValueTree is initialized once. I then had errors in the beginParameterChangeGesture method.

What I want to avoid is to store a reference of my modules in the processor as they are stored in the editor.

Thanks in advance.


I did this in a prior project by making a “processor component” class with a callback called registerParameters(). Each processor component would be created and have its registerParameters() called during plugin instancing. It worked very well and ended up very clean.

Base class, where each module was a custom AudioPluginInstance type:

A corresponding derived module, registering its parameters:

The plugin constructor, where all custom modules are instantiated and registerParameters() called before creating the final state tree:


Wow, thank you !