AudioProcessorValueTreeState wraps AudioProcessorParameters, so you can use either in the constructor addParameter (new AudioProcessorParameterFloat());
or treeState.createAndAddParameter (...);
but you cannot mix them.
exactly, the host will check if this change is ok with it’s automation settings and call in turn setValue() of your processor parameter (e.g. if it’s set to read, it might not accept the change).
If you use AudioProcessorValueTreeState, you have the additional feature to register the processor as listener of a parameter and implement a callback, whenever the host changes a parameter: AudioProcessorValueTreeState::Listener
In get/setStateInformation you don’t need to do anything, if you only have automated parameters. If you have e.g. a tabbed component in your editor and want to restore, which tab was selected, you write that information in getStateInformation into the project file and restore it, when setStateInformation is called.
I usually have an AudioProcessorValueTreeState member called mState, set in the constructor (after the createProcessorParameter calls) an ValueTree like
mState.state = ValueTree ("MySetup");
and save and restore like this:
void MyAudioProcessor::getStateInformation (MemoryBlock& destData)
{
MemoryOutputStream stream(destData, false);
mState.state.writeToStream (stream);
}
void MyAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
ValueTree tree = ValueTree::readFromData (data, sizeInBytes);
if (tree.isValid()) {
mState.state = tree;
// synchronize here the state with the actual values
// or even better use the editor as ValueTree::Listener on mState.state
}
}
Now you can use the state to save whatever you want like:
mState.state.setProperty (“MyGuiValue”, 5, nullptr);
But again, you don’t need this for parameter values.