Latest AAX wrapper overwrites startup settings


#1

I updated to the latest version of the AAX wrapper today and run into the issue that it is not possible to load a simple default preset from the AudioProcessor constructor anymore. ProTools sends 0 values to all parameters after the plugin loaded the startup preset.

Changing the wrapper back to an older version fixes the issue. I see in the code that a lot of things changed (Normalized parameters and other changes). 

Any help is welcome.


AAX changing parameter between prepareToPlay and 1st processBlock
#2

Ok, i found the problem. There is a default parameter value. It seems that pro tools always takes this one if you instantiate a new plugin. 

AAX_Result GetParameterDefaultNormalizedValue (AAX_CParamID paramID, double* result) const override

I'm sure a lot of plugins implemented something like a default preset already... removing this method leads to the common behavior.


#3

Wouldn't it make more sense to implement AudioProcessor::getParameterDefaultValue in your plugin so that the behaviour works correctly?


#4

Sure, i will do this as soon as i have some time. Is this feature only supported by AAX or does it also affects the other wrappers?


#5

I think AU supports it too IIRC.


#6

Odd.  When my plugin is opened in Protools I get called twice, once with the default value provided by the getParameterDefaultValue() method and then a second time with a 0.  Anyone seen this before? 

cheers, J. 


#7

The call stack is different though.  The second time, with the wrong value, it's coming via AAX:Classes::JuceAAX_Processor::setChunk() and SendRampUpdates() .. mmm off to read the manual.

Update: presume it's something to do with this: 

"When a plug-in is first instantiated, CProcess::GetChunk() is called to retrieve the plug-in’s default chunk. Pro Tools caches this chunk in the session and associates it with the plug-in, andCProcess::SetChunk() is called with this default chunk on any future instantiations of the plug-in in the session."


#8

Right - turns out you need to clear the cache - see my post on the digi developer forum.  This problem has some implications for default preset handling which I'll pick up with Avid...


#9

Hi Jules

 

i've had to revert back to old AAX wrapper because of this above code implementation.

i had a read about in the AVID dev forums and came across an article regarding the CompareActiveChunk, SetChunk and GetChunk order.

https://developer.digidesign.com/index.php?L1=5&L2=13&L3=19&LC=/?p=1092

 

The problem im having is that our internal preset system is totally wonky with the latest wrapper code and doesn't recall preset names. 

im sure its something in my code that probably needs attention to fix this, but the old wrapper code works fine with the preset system.

 


#10

 

Hi all,

I'm in the process of creating an AAX version of our synth plug-in, and have run into the problem where Pro Tools sets all the parameters to 0.0f...

Now, I could, as Jules suggests, override AudioProcessor::getParameterDefaultValue and assign the correct default parameter values.

However, I have read many posts on here and the Digi DevCon forums about SetChunk and GetChunk etc - is implementing my own chunk handler the way forward?

 


#11

Please don't use the old (and soon to be deprecated) getParameterDefaultValue method - there are now methods in the AudioProcessorParameter class that you should override to do that kind of thing, and we've added some functionality to that class that doesn't exist in the processor base class.


#12

Hi MCSoftware, as Jules said you should be using the AudioProcessorParameter class. This class will force you to override getDefaultValue which should return the value the parameters should have if the user opens your plug-in on a new track for the first time. The setChunk/getChunk calls are used to save/load your plug-in's state (including the values of your parameters) from a project file. These AAX calls simply get redirected to your AudioProcessor's setStateInformation/getStateInformation. You must restore your Plug-in's parameter values with the data supplied in the  setStateInformation call. Here is some minimal code to save/restore your parameters using JUCE's ValueTree (note: this will only work if you are using the new AudioProcessorParameter class):


void PlugInProcessor::getStateInformation (MemoryBlock& destData)
{
    ValueTree parameterValues ("Parameters");
    {
        const OwnedArray<AudioProcessorParameter>& myParams = getParameters();
        for (int i = 0; i < myParams.size(); ++i)
            parameterValues.setProperty (myParams[i]->getName (256), myParams[i]->getValue(), nullptr);
    }
    
    MemoryOutputStream outStream (destData, true);
    parameterValues.writeToStream (outStream);
}
void PlugInProcessor::setStateInformation (const void* data, int sizeInBytes)
{
    ValueTree parameterValues = ValueTree::readFromData (data, (size_t) sizeInBytes);
    {
        const OwnedArray<AudioProcessorParameter>& myParams = getParameters();
        for (int i = 0; i < myParams.size(); ++i)
        {
            double value = (double)parameterValues.getProperty (myParams[i]->getName (256),
                                                                static_cast<double> (myParams[i]->getDefaultValue()));
            myParams[i]->setValue (static_cast<float> (value));
        }
        
    }
}


#13

Did you ever find a workable solution for custom default presets with JUCE in AAX?

This seems to only be true before Pro Tools has cached the default chunk. I think the code you’ve posted will only work in cases where the default parameter values never change.