AAX initial preset getting wiped

Hi, I’ve finally got a version of AAX to debug on Windows. The problem I’ve got is that a fresh inserted plug-in is receiving a wrong setStateInformation, but bizarrely, it has the correct XML tagName, even though it’s just been inserted, and getStateInformation has never been called! All the data within it is zero. How do I get around it officially?
Do I just test for something like an invalid plug-in size, then just load a preset? But that seems an unlikely solution.
Dave H.

OK. I’ve got some weird order going on here. And I suspect it’s getting out of sync at startup.
For example I’m doing this, with init parameters…

pluginParams.createAndAddParameter("parGlobalWet", "Output Wet", "", range, .5f, nullptr, nullptr);

Them I’m setting them using a preset with different values, something like this, p being my internal preset array of values.

		par = pluginParams.getParameter("parGlobalWet");
		if (par) par->setValue(p->parGlobalWet);

Then Juce calls AAX- GetChunkSize which seems to ONLY get called if the plug-in is newly compiled!
This calls getStateInformation which then saves my preset, but not the new updated values.
So I’m wondering if there’s a way of forcing my above value changes so that the parameter changes go through to the state save?
This all works fine for AU & VST because the state is not saved by the host immediately.
Thanks,
Dave.

Did you try, if that’s still the case with a fresh project? I would be surprised, if there was a global storage of default states.

But most important, you must not call setValue from your plugin. Since the host is in charge of the parameter values (due to automation and it’s record mode) your parameter is changed from the host.
If you load the preset, you tell it the host using setValueNotifyingHost(), which will call your setValue, if it’s appropriate given the automation mode (in “read” mode it might not do that, but I don’t know how it is implemented, you have to check that yourself).

See the docs for setValue():

If you want to set the value of a parameter internally, e.g. from your editor component, then don’t call this directly - instead, use the setValueNotifyingHost() method, which will also send a message to the host telling it about the change. If the message isn’t sent, the host won’t be able to automate your parameters properly.

Thanks!
I just tried setValueNotifyingHost() but it still only uses the values made when creating the parameter, this is very annoying. If there’s any delay at all in the parameters changing then it’ll miss it.
This also happens with a fresh project. It looks like I have to now create the parameters with the preset’s values, rather than do it immediately afterwards. But I guess everybody else is doing that, otherwise they’ll get the same problem?

aaaagh I can’t use the ‘default’ values for the preset parameters because I need that as a reset value for each slider and dial.
So when are people setting the preset program then? I’m lost, do I use a timer and set it in a short while? Surely that’s well dodgy.

Is the system you’re using got a control surface attached?

No, it’s just a computer on its own.
edit I’m using a Focusrite Scarlett 18i20 output.

So in summary - I can’t set my parameters in the processor constructor because Pro Tools (2018.7) saves the parameters as their default values before they get a chance to change. And this only happens the first time the plug-in is compiled, the second time it’s run, the old startup state is remembered, which of course is the wrong one. This is without saving a project and loading it into an insert every time.
Where/when do people set the load up preset please? I’ve clearly missed something major here.
Thanks,
Dave H.

OK My work around for now is some simple logic. If the GUI has never been opened before then use a preset. And that’s it, because when the Pro tools state is first saved there is no GUI constructed yet. But one is always made later when a new plug-in is inserted.

1 Like