AudioUnit synth: Wrong channel layouts reported by auval when using isBusesLayoutSupported

OK - false herring. It seems that Apple has silently upgraded auvaltool. Due to macOS’ system integrity protection, I keep a copy of auvaltool in /usr/local/bin for debugging - which was the older version.

At one point, I turned off system integrity protection and so some of my test projects use the auvaltool in /usr/bin and some of them use the one in /usr/local/bin.

Nevertheless, the debugger certainly doesn’t like the braces initialiser as it doesn’t seem to be able to step over or into it. That just added to confusion.

Now to the real bug: the auvaltool is doing something really confusing. If you look at the output of the old auvaltool it would look like this:

# # AudioChannelLayouts (6), Output Scope:
ChannelLayout is Writable: T
The Unit publishes the following Channel Layouts:
  0x790006, 0x6C0004, 0x7A0006, 0x7B0006, 0x7C0006, 0x840004, 

Is Audio Channel Layout Available:
Mono    Stereo  Binau.  AU_4    Ambi.   AU_5    AU_5_0  AU_6    AU_6_0  AU_7_0  AU_7_0F AU_8    AU_5_1  AU_6_1  AU_7_1  AU_7_1F 
						X                                                                       X                               

Current Format:AudioStreamBasicDescription:  4 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved
Current Format Tag = 0x6C0004, New Format Tag = 0x6C0004, Successsful

Current Format:AudioStreamBasicDescription:  4 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved
Current Format Tag = 0x6C0004, New Format Tag = 0x790006, Success - did not reset format with mis-matched layout

First of all, auvaltool begins with showing you a list of all the layouts in hexadecimal (0x790006, 0x6c0004, 0x7a0006, 0x7b0006, 0x7c0006, 0x840004). The least significant 16 bits are the number of channels in the layout, so all the tags that the AU reports are 4 and 6 channel layouts. In fact, if you look them up, this is exactly what the AU should report as the 6-channel layout tags are all the same layout (5.1 Surround) but with different speaker ordering. The same is true for the 4-channel layouts.

auvaltool then prints this “Mono Stereo Binau. AU_4…” list with crosses or no-crosses. These layouts are the more common layouts (and speaker ordering) used with AudioUnits. Up until today, I thought this list was really just a human-readable subset of the layout tags reported above (the hexadecimal numbers.

Then auvaltool actually tries setting the supported, most common AU layouts. You can see how auvaltool will try to only set those layouts that were marked with the x. This all makes sense.

Now look at the output of the new auvaltool:

# # AudioChannelLayouts (6), Output Scope:
ChannelLayout is Writable: T
The Unit publishes the following Channel Layouts:
  0x790006, 0x6C0004, 0x7A0006, 0x7B0006, 0x7C0006, 0x840004, 

Is Audio Channel Layout Available:
Mono    Stereo  Binau.  AU_4    Ambi.   AU_5    AU_5_0  AU_6    AU_6_0  AU_7_0  AU_7_0F AU_8    AU_5_1  AU_6_1  AU_7_1  AU_7_1F 
						X       X                                                                       X       X                               

Current Format:AudioStreamBasicDescription:  4 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved
Current Format Tag = 0x6C0004, New Format Tag = 0x6C0004, Successsful

Current Format:AudioStreamBasicDescription:  4 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved
Current Format Tag = 0x6C0004, New Format Tag = 0x790006, Success - did not reset format with mis-matched layout

Everything is the same except for where auval puts it’s crosses - which is just entirely confusing. First of all, the hex numbers are exactly the same. Specifically, the number of channels in those layouts are either 4 or 6. Yet, auvaltool still comes to the conclusion that the AU somehow supports AU_7 (which has 7 channels). But to confuse things even further, auvaltool then proceeds to only test the quadrophonic and Surround 5.1 layout?!? But in the step before it thought that the surround 5.1 layout isn’t even supported.

In any case, Logic does not seem to be affected. All though the auval result will be wrong, Logic Pro will still allow you to load it onto a 5.1 and quadrophonic track only.