Simple question, I’m not sure if it was already answered somewhere here
While building a plugin with a bunch of parameters managed by the AudioProcessorValueTreeState, I need to store some settings of the plugin that are no parameters but that hold a certain state of the user interface. As a load/store operation should also store/restore those, I thought it would be handy if I just added some additional properties to the ValueTree used by the AudioProcessorValueTreeState. Like this:
MyPluginAudioProcessor::MyPluginAudioProcessor() : //...
{
// parameters is my APVTS
parameters.state = ValueTree (Identifier ("MyPlugin"));
// uiState is a Identifier member
parameters.state.setProperty (uiState, "", nullptr);
}
// then somewhere in the code, might be in the processor or editor:
String currentState = parameters.state.getProperty (uiState).toString();
// do something with it...
parameters.state.setProperty (uiState, newState, nullptr);
A quick test with the default standalone build worked fine, however, I’m not sure if this is a dangerous hack or a safe operation. If it shouldn’t be done this way, what are best practice examples of how to store additional state information that are accessible all over the plugin?