Storing more state info than AudioProcessorValueTreeState


Up until now, all the state information I’ve needed to store has been in my AudioProcessorValueTreeState, and I’ve stored it thusly:

void PluginAudioProcessor::getStateInformation (MemoryBlock& destData)
	MemoryOutputStream stream(destData, false);

void PluginAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
	ValueTree tree = ValueTree::readFromData(data, sizeInBytes);

However, I’m now working on a plugin that needs to maintain state information beyond just the parameters in my AudioProcessorValueTreeState. For example, I’d like to maintain the address of an audio file so that the plugin can attempt to reload it when the host reopens a session, and other variable values, in addition to my AudioProcessorValueTreeState.

How can I go about doing this?


There are lots of ways, but maybe the cleanest is to have a parent ValueTree that contains both the ValueTree you use for your AudioProcessorValueTreeState, and any other ones you need to store other properties.