I have been trying to use AudioProcessorValueTreeState to manage the state of a plugin. I need to store the contents of some other ValueTrees in the state that are arbitrary data not linked to parameters.
in my processor constructor, i have something like this
mAPVTS.createAndAddParameter(...) mAPVTS.createAndAddParameter(...) mAPVTS.state = ValueTree("root"); mAPVTS.state.getOrCreateChildWithName("child1", nullptr); mAPVTS.state.getOrCreateChildWithName("child2", nullptr);
In set state / get state information I serialise and restore the main APVTS value tree.
I have a UI component that stores it’s state into one of the child value trees, and when the plugin state is restored, the component seems to refer to a different value tree.
What is the best way to deal with multiple value trees in this situation and keep them all referring to the correct things?