Trouble finding index corresponding to Nth channel of AAX output in processBlock()

Hi all,
I’m working on an AAX plugin that’s capable of outputting a number of layouts with a number of different channel widths. I’ve noticed that the nth channel in the processBlock array doesn’t necessarily correspond to the nth channel of the output in pro tools, so I’m in search of a method that will let me get the process block array index corresponding to the Nth channel of the plugin’s output. I thought I may have found this in getChannelIndexInProcessBlockBuffer, but I’m finding this difficult to use (perhaps because I’m using it wrong). Since there’s only one output bus, I tried getChannelIndexInProcessBlockBuffer(false, 0, n) to get the process block buffer index corresponding to the nth output channel, but I find that I always get n back though even when this is not the case (in LCR, for example, the channel corresponding to the “1” index in processBlock is the third channel of the output; I can provide an example if necessary).

I’d be surprised if there isn’t a method to do what I need already around – can anyone here point me in the right direction?

1 Like

The AAX wrapper reorders the channels in the AudioBuffer to the JUCE order which is different to the AAX order… so you would process your AudioBuffer in the JUCE order… if you need to know the original AAX channel order you’ll have to deal with that yourself… JUCE has no mechanism currently to get that. the AAXClasses aren’t available publicly…

I recently started a thread which discussed some of this:

I created a separate utility with copies of some of the AAXClasses’ code in a new namespace with this:

static StringArray getAAXSpeakerArrangementAsString (AAX_EStemFormat aaxStemFormat)
{
    StringArray speakerTypes;
    
    int layoutIndex;
    
    for (layoutIndex = 0; aaxChannelOrder[layoutIndex].aaxStemFormat != aaxStemFormat; ++layoutIndex)
        if (aaxChannelOrder[layoutIndex].aaxStemFormat == 0) return {};

    auto& channelOrder = aaxChannelOrder[layoutIndex];
    const auto& speakerOrder = channelOrder.speakerOrder;
    
    for (auto spker : speakerOrder)
        {        
        String szChannel = AudioChannelSet::getAbbreviatedChannelTypeName (spker);
        
        speakerTypes.add (szChannel);
        }
    
    return speakerTypes;
}

I actually was gonna contact the JUCE devs to ask them to reformat the AAX wrapper slightly which would help us not have to duplicate the AAXClasses AAX_EStemFormat and AAXChannel_StreamOrder…

Have them rename the juce_audio_plugin_client_AAX.cpp file to a header and add a #pragma once at the top… and in juce_audio_plugin_client_AAX.cpp just include the juce_audio_plugin_client_AAX.h

I had to do this for adding the AAX DSP mods as well since they also need to use the AAXClasses externally so I needed to include the juce_audio_plugin_client_AAX.h

Cheers!

Rail

3 Likes

Thanks Rail, I appreciate the response! This makes sense, I’ll look into making some tweaks to the AAX layer in our juce fork.
Best,
Isaac

1 Like