Multiple Child Components referencing APVTS Parameters


I am making an EQ with multiple bands. Each band requires a center frequency slider and band gain slider. I want to create a component class that contains the sliders so that the component can be easily duplicated for each band. I would like to use the AudioParameterValueTreeState class to manage and maintain all parameters in my plugin, however I am trying to work out how this would work best. I think I would need separate identifiers for each of the parameters which are initialised in my processor and then passed to my component for each instance (along with a reference to the apvts), thus allowing the referenced apvts instance to access the required parameter.

I suppose another way could be to create an apvts with different identifier for each band? In that way the identifier names don’t change, just the aptvs reference.

Or is there a better way of doing this?

Thanks heaps.

The way I chose in my Frequalizer was to wrap the parameterIDs in static functions, that assemble an ID using the number:

What I would change in retrospect is, to have a struct around each band filter, that has stores the float* getRawParameterValue (ID) to avoid lookups (even though they are in a map, so shouldn’t be too bad).

But there are many ways to Rome.

1 Like

Wow @daniel

That is some useful code - thanks for sharing. I ended up just creating parameters in the traditional manner as the repetition I required was minimal. I might revisit this though to make my plugin more reusable for different configurations.