AU Parameter Order

In a plugin I have whose params are not inheriting AudioProcessorParameter the parameters order is the same in AU and VST. But in plugins using AudioProcessorParameterWithID, the order is different in the AU indeed.

This is because the JUCE AU Wrapper calls AUScopeElement::UseIndexedParameters (numParams) when you use legacy parameters. Apparently the Apple audiounit code stores the parameter list in a std::map when using paramID instead of indexes. And its GetParameterList implementation is:

AUElement::GetParameterList(AudioUnitParameterID *outList)
{
	if(mUseIndexedParameters)
	{
		UInt32 nparams = static_cast<UInt32>(mIndexedParameters.size());
		for (UInt32 i = 0; i < nparams; i++ )
			*outList++ = (AudioUnitParameterID)i;
	}
	else
	{
		for (ParameterMap::iterator i = mParameters.begin(); i != mParameters.end(); ++i)
			*outList++ = (*i).first;
	}

So they are listed in the std::map order , that is by ascending paramID

To be honest, this sucks. Now that I have switched my plugin to the new AudioProcessorParametersWithID parameters, I have a few hundred parameters that are displayed in a random order in the AU plugin hosts (Logic , Reaper etc). This does not feel like progress.