Channel ordering problem in Audio Units with Logic Pro X

Hi

I’ve come across a problem with channel ordering in Logic X (5.1 and 7.1).

I’m not receiving audio in the expected Juce order, for example in 5.1:
L R C LFE Ls Rs

Plugins are receiving audio in this channel order:
L R Ls Rs C LFE

I’ve verified the behaviour using the example Surround PIP (Juce 5.4.7, Logic X 10.5). If I build that, drop it onto a surround aux with a Logic ‘Level Meter’ after it, click the test signal buttons, I get L and R correct, clicking C shows up in Ls, LFE ends up in Rs, Ls to C and Rs to LFE.

That seems to correspond internally to Logic using a layout of kAudioChannelLayoutTag_MPEG_5_1_B.

Juce’s AudioChannelSet::create5point1() set is tagged to use kAudioChannelLayoutTag_MPEG_5_1_A.

I note that if I restrict the channel formats via isBusesLayoutSupported to stereo + 5.1, as follows:

bool isBusesLayoutSupported (const BusesLayout& layouts) const override
{
    if(   (!layouts.getMainInputChannelSet().isDiscreteLayout())
       && (!layouts.getMainOutputChannelSet().isDiscreteLayout())
       && (layouts.getMainInputChannelSet() == AudioChannelSet::stereo() && layouts.getMainOutputChannelSet() == AudioChannelSet::stereo()))
        return true;

    if(   (!layouts.getMainInputChannelSet().isDiscreteLayout())
       && (!layouts.getMainOutputChannelSet().isDiscreteLayout())
       && (layouts.getMainInputChannelSet() == AudioChannelSet::create5point1() && layouts.getMainOutputChannelSet() == AudioChannelSet::create5point1()))
        return true;

    return false;
}

That auval returns supported channel layouts as:
--------------------------------------------------
VERIFYING DEFAULT SCOPE FORMATS:
Input Scope Bus Configuration:
Default Bus Count:1
Bus Name: Input
Default Format: AudioStreamBasicDescription: 2 ch, 44100 Hz, ‘lpcm’ (0x00000029) 32-bit little-endian float, deinterleaved
Has Channel Layouts: 0x650002 0x790006 0x660002 0x670002 0x6A0002 0x7A0006 0x7B0006 0x7C0006
Default Layout:
Tag=0x650002, Num Chan Descs=0

Output Scope Bus Configuration:
 Default Bus Count:1
    Bus Name: Output
    Default Format: AudioStreamBasicDescription:  2 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved
    Has Channel Layouts: 0x650002 0x790006 0x660002 0x670002 0x6A0002 0x7A0006 0x7B0006 0x7C0006 
    Default Layout:
	Tag=0x650002, Num Chan Descs=0

These decode out to:
0x650002 kAudioChannelLayoutTag_Stereo
0x790006 kAudioChannelLayoutTag_MPEG_5_1_A // L R C LFE Ls Rs
0x660002 kAudioChannelLayoutTag_StereoHeadphones
0x670002 kAudioChannelLayoutTag_MatrixStereo
0x6A0002 kAudioChannelLayoutTag_Binaural
0x7A0006 kAudioChannelLayoutTag_MPEG_5_1_B // L R Ls Rs C LFE
0x7B0006 kAudioChannelLayoutTag_MPEG_5_1_C // L C R Ls Rs LFE
0x7C0006 kAudioChannelLayoutTag_MPEG_5_1_D // C L R Ls Rs LFE

There are a surprisingly large number of supported channel formats. I would only expect to see kAudioChannelLayoutTag_Stereo (0x650002) and kAudioChannelLayoutTag_MPEG_5_1_A (0x790006). The fact that kAudioChannelLayoutTag_MPEG_5_1_B is showing as being supported inclines me to think this is being preferred by Logic X for some reason, and the plugin is saying it can handle it, so that gets picked and we end up with an incorrect channel routing.

Anything we can do to resolve that?

Matt

can confirm. i have Logic’s meter after the surround example plug-in, and when triggering the Lfe channel, it seems to show up in the “Rs” channel.