AAX Channel order

So I create a 7.1.2 track in Pro Tools and in prepareToPlay() I do some checking using:

    AudioChannelSet channelSet = m_LastLayout.getMainOutputChannelSet();
    
    int iNumChannels = getTotalNumOutputChannels();
    
    for (int i = 0; i < iNumChannels; ++i)
        DBG (juce::AudioChannelSet::getChannelTypeName (channelSet.getTypeOfChannel (i)));
    
    if (iNumChannels > 2)
        {
        const auto iIndex = channelSet.getChannelIndexForType (juce::AudioChannelSet::centre);
        const auto channelIndex = getChannelIndexInProcessBlockBuffer (false, 0, iIndex);

        DBG ("centre Index: " << channelIndex);
        }

prints out:

Left
Right
Centre
LFE
Left Surround Side
Right Surround Side
Left Surround Rear
Right Surround Rear
Top Side Left
Top Side Right

centre Index: 2

which is incorrect for

AAX_eStemFormat_7_1_2,    { 

AudioChannelSet::left, 
AudioChannelSet::centre, 
AudioChannelSet::right, 
AudioChannelSet::leftSurroundSide, 
AudioChannelSet::rightSurroundSide,
AudioChannelSet::leftSurroundRear, 
AudioChannelSet::rightSurroundRear, 
AudioChannelSet::LFE, 
AudioChannelSet::topSideLeft, 
AudioChannelSet::topSideRight }

Centre index should be 1

I see in the wrapper that rebuildChannelMapArrays() should remap the channels… but it doesn’t seem to be working.

Also if I use

AudioChannelSet set = layout.getMainOutputChannelSet();

StringArray szSpeakerArray = StringArray::fromTokens (set.getSpeakerArrangementAsString(), false);

The order is also wrong and reports L, R, C, …

Rail

m_LastLayout is initialized and reset in:

void DRC2NativeAudioProcessor::processorLayoutsChanged()
{
    juce::AudioPluginInstance::BusesLayout newLayout = getBusesLayout();


}

Rail

Okay… It appears that the AudioBuffer is sorted in the AAX wrapper to match the JUCE order:

0
2
1
7
3
4
5
6
8
9

So I guess I have to re-order the meter and channels in the UI to display them in the expected AAX order… but it would help if there were some methods in the AudioChannelSet class to get the native channel order.

Rail