AAX Chunk Size (non-fixed)

Has anyone figured out a way to have a non-fixed chunkSize in AAX?

My getStateInformation method may return a different size destData MemoryBlock depending on how many widgets I have in my plugin.

Unfortunately this doesn’t appear to be supported.

Do I just create a large MemoryBlock for my worst case situation and pad it with zeroes when I don’t need to fill it?



I don't use Juce plguin framework, but AAX have two functions




This works fine as my plugin do not have a fixed size either.

and looking at Juce code, they do support it.

So I think you are doing something wrong. Not Juce.

The problem I have is that in the JUCE AAX wrapper… for GetChunkSize():

        AAX_Result GetChunkSize (AAX_CTypeID chunkID, uint32_t* oSize) const override
            if (chunkID != juceChunkType)
                return AAX_CEffectParameters::GetChunkSize (chunkID, oSize);
            juce::MemoryBlock& tempFilterData = getTemporaryChunkMemory();
            pluginInstance->getStateInformation (tempFilterData);
            *oSize = (uint32_t) tempFilterData.getSize();
            return AAX_SUCCESS;

It gets the chunk size by calling getStateInformation() which may return a different size than the saved chunk… which is what I’m seeing.

I’m not excluding the fact that I may be doing something wrong – but while debugging I noticed the above. My getStateInformation() and setStateInformation() are working fine in VST… but the data is truncated and the values appear to be incorrect in AAX when loading a saved Pro Tools session. If I save the dataChunk to disk in getStateInformation & setStateInformation – the files are identical… but in Pro Tools the setStateInformation file is truncated because of the above JUCE code.



As far as I remember, GetChunkSize and GetChunk are called one after another so unless you save some information which get incremented at each serialization or whatever, it should be fine.


Check the setParameter called by PT after the SetChunk. I know PT do some weird stuff

Thanks I’ll check that – but the issue isn’t a threading issue…

Say at the time the Pro Tools session is saved, my plugin has 15 widgets and each widget is saved in 10 bytes… the chunk size will be 150 bytes.

The default plugin only has 2 widgets when it’s instantiated – and the user may add more widgets as they like… So when we close the PT session and the re-open the PT session and it calls GetChunkSize it returns 20 bytes… so the call to GetChunk is only 20 bytes… not the 150 bytes the PT session was saved with.



In the debugger Xcode just jumps over the lines in SetChunk… so it’s a little hard to know what’s really happening in there – the debugger jumps from the if() right to return…

        AAX_Result SetChunk (AAX_CTypeID chunkID, const AAX_SPlugInChunk* chunk) override
            if (chunkID != juceChunkType)
                return AAX_CEffectParameters::SetChunk (chunkID, chunk);
            pluginInstance->setStateInformation ((void*) chunk->fData, chunk->fSize);
            // Notify Pro Tools that the parameters were updated.
            // Without it a bug happens in these circumstances:
            // * A preset is saved with the RTAS version of the plugin (".tfx" preset format).
            // * The preset is loaded in PT 10 using the AAX version.
            // * The session is then saved, and closed.
            // * The saved session is loaded, but acting as if the preset was never loaded.
            const int numParameters = pluginInstance->getNumParameters();
            for (int i = 0; i < numParameters; ++i)
                SetParameterNormalizedValue (IndexAsParamID (i), (double) pluginInstance->getParameter(i));
            return AAX_SUCCESS;


Well, FWIW, I use the same code and my pluhin has definitly a variable chunk size and it works so if I were you, I would check elsewhere.

Does AAX also use GetChunkSize to determine the chunk size when loading a plug-ins state, i.e. is the GetChunkSize followed by a SetChunk call?


But I’ve figured out where my issue lies… It’s in the kludge I had to detect if this is the first or second time that Pro Tools is calling setStateInformation().

When I load a new PT session and instantiate the plugin I get a single call to SetChunk()

If I then save the PT session I get:


If I then open the saved session SetChunk() gets called twice… the first time with the default settings (and the default size)… and the second time with the saved settings from the session file (with the correct size).

Because my mixer is created before setStateInformation() is called it needs to ignore the first set of values - I had a kludge where it ignores the values until a flag was set. I had to fix that kludge to get the second values.