Hi, I have a plug-in that doesn’t have any saved presets. It’s just a simple 5 value processor.
How do I set up parameters values for startup? - I don’t mean a host saved state.
And I don’t mean ‘default’ values, which I use as useful reset positions.
I currently put it at the end of my AudioProcessor constructor, which works well for VST & AU, but AAX just ignores everything I do in the constructor and just uses the ‘default’ values from ‘createAndAddParameter’ which would normally be fine, but I want an initial state which is not a default state.
I need to do this in code. What’s the most elegant way of doing this please?
p.s. I found a way of putting it into the Editor startup, but that’s just a messy way of doing things, and I’d rather not put it there.
setCurrentProgram is not called when an AAX starts up it seems.
Thanks for the reply.
Yeah, that’s what I’m doing. It doesn’t seem to work with an AAX though.
It’s a real shame that set and get current program is not called either. edit I’m doing this last thing in the constructor.
I have a function that calls these:-
[error checking removed for clarity]
void setParameterNotifying(String name, float v)
AudioProcessorParameterWithID* par = paraTree.getParameter(name);
NormalisableRange<float> nor = paraTree.getParameterRange(name);
v = nor.convertTo0to1(v);
Are you sure the parameters are not getting set? Maybe it’s just that your editor isn’t seeing those values? If you’re not using attachments, then maybe you need to query the parameters when the editor is opened and set your controls to the proper values (WITHOUT notifying the host)?
On a possibly related note, the second and subsequent instances of an AAX plugin get set to the values reported by the first instance to be created, because Pro Tools calls our getStateInformation() on the first instance, and then calls setStateInformation() on all subsequent instances. So, for second and subsequent instances, the initial state may get changed by Pro Tools.
I’m getting getStateInformation, then setStateInformation being called when I first insert the plug-in.
[ incidentally, if I delete the plug-in from the insert list, when I load it in again, getState is not called. ]
They are still set to the default values, even though I set them with OR without notifying the host.
BTW I’m using ProTools 12.4.0 on Windows.
The parameters are not being changed. Either in the processor OR the editor, they are just being set to default.
I am using attachments. As far as I know I’m doing everything correctly.
I’m not a pro but maybe the deprecated createAndAddParameter is the problem? I use the ParameterLayout way as explained in the tutorials and recall is working fine for me with AAX on macOS, haven’t tried in Windows though.
Can anyone describe how I do this the ‘proper’ way? I’m getting little bit lost with all different approaches:
This is an example of my CPP file, as you can see, I’m using ‘paraTree’ which is an ‘AudioProcessorValueTreeState’:
I need to setup the NormalisedRange class before the parameter is added, as it’s used in other parameters as well.
I can’t find any examples of people using ‘apvts’ anywhere, the example demos just use ‘AddParameter’ which means they need a local parameter store, which I didn’t need before.
If you need to hold onto the individual parameter pointers (maybe for faster lookup), you will need to adjust this approach slightly to also return the pointers to the individual parameters. There’s an example of this slightly more advanced usage in the DSPModulePluginDemo.
IIRC, Pro Tools has a caching mechanism that basically stores the state of the plugin the very first time you load the plugin (via getStateInformation()) and then overwrites the default values via setStateInformation() the next times the plugin is loaded.
I don’t know if this is your case, but try to comment out the content of your setStateInformation implementation and see if it helps.
I’m not 100% sure, but if you remove the plugin, launch PT, then put the plugin back and re-launch PT, it should reset this cache.
Ok thing’s are getting weird. I just tested the Gain Demo and cleared getStateInformation and setStateInformation. You can see on the debug console that nothing is getting recalled from const void* data. But Pro Tools is still saving and recalling the parameter value. You can even save Plug-In Presets and recall them. When making the plug-in inactive and reactivate it, the value also gets recalled.
and lastly, in one of the threads was a good hint on the cached parameters from plug-ins binaries:
you should check the DigiOptionsFile in the AAX manual or simply trash your plug-ins from your plug-ins folder, open Pro Tools, close Pro Tools and then recompile your AAX binaries. This will erase the plug-in cache. That helped me with an assertion error when loading the factory default settings while instantiating a plug-in. Actually it recalled trash from an older version…
Yeah, I just re-installed ProTools to version 2020.9 and I still can’t get it off the default values. It doesn’t matter what values I set them to when I quit the plug-in last.
When ‘getState’ is called the values are always already set to the default parameter values, not the values I set in the constructor.
(edit: so the values are being set to default before any state information is called, which means I have no chance of changing the values, unless I do it in the Editor constructor as first stated above)
I wonder if there’s a way to force the values in getState the first time it is run? It seems like a really dodgy thing to do, but it’s kind of logical, being in a place that handles state information.
I’m at my wits end right now. I wish there was an official way of doing this properly on AAX.
It would be nice if the parameters would have a default value AND a starting value.