The recommended way is now to construct the AudioProcessorValueTreeState
directly with a ParameterLayout
containing all the parameters.
I got some code where I pass around the valueTreeState to different classes at construction, and create a couple of parameters within my mainProcessor, and some other ones in those other classes. something along those lines :
struct MainProcessor : public AudioProcessor
{
MainProcessor()
: state (*this, nullptr)
, anotherProcessorClass (state)
{
state.createAndAddParameter (...);
}
AudioProcessorValueTreeState state;
AnotherProcessorClass anotherProcessorClass;
};
struct AnotherProcessorClass
{
AnotherProcessorClass (AudioProcessorValueTreeState& state)
{
state.addListener (this);
state.createAndAddParameter (...);
}
};
Was it bad practice?
It seems to me I can’t really do that anymore with the new recommended AudioProcessorValueTreeState
constructor no? (I only had a quick look, so perhaps I’m missing something simple)