Thank you for the reply, Anthony. Your questions helped me figure out what was going on here.
Yes, I agree - after some reflection I came to the same conclusion, that providing NO data back to the host from
getStateInformation might cause it to fall back to a “sensible” default behavior. So that’s why I then substituted that other code shown above for
getStateInformation, where I do provide data back, but where I alter a parameter value.
OK, fair enough - you’re making the distinction that Pro Tools doesn’t parse the XML I pass it from
getStateInformation. So, to correct my previous statement: it should be clear that I’ve passed Pro Tools a set of XML data with the gain param set at 0.666.
Good question - yes, I just checked that, and I can confirm that now. If I passed Pro Tools a param value of 0.666 in the XML data, it passes that value back to
And therein lies the source of my confusion, I think. If, in
setStateInformation, I don’t call
AudioProcessorValueTreeState::replaceState, then Pro Tools still loads its own set of saved parameter values. Going back to your first point, about hosts reading/writing param values however they like, that makes a certain sense.
However, this breaks the mental model I had about Pro Tools’ preset files - that they would be storing ONE set of param values. In fact, they seem to be storing TWO sets of param values, their own snapshot, and whatever XML data you pass to the host. OK, fine, my mental model stands corrected on this matter!
This also answers your question, “do the
setParameter() calls happen before or after the
setStateInformation()?”. Thankfully, the setParameter calls must be happening before setStateInformation call, since if
replaceState is called, then those XML-saved values are indeed the final values displayed in the plug-in.
The use case here is to prevent preset saving/loading, as a limitation on the demo version of a plug-in.
In essence, the part that tripped me up here is that in Pro Tools (unlike in the other hosts I tested), in order to have preset saving/loading “do nothing”, I cannot just let the code “do nothing”. Instead, when the plug-in is in demo mode, I will need to set the APVTS to default parameter values when
setStateInformation is called. This will have the unfortunate side effect of wiping out a user’s current settings if they innocently try to load a preset file while in demo mode…
Thanks again for engaging with this issue.