AudioChannelSets lose the specified channel order


I’ve been working on some level meters for my GUIs and I’ve come across an issue where JUCE loses the order of the channels being passed in to the AudioChannelSet class, though the audio is routed through correctly.

For example:
If I open my plugin in 7.1.4 in Nuendo 12, Nuendo creates a track with the following channel order
L R C LFE Ls Rs Sl Sr Tfl Tfr Trl Trr
where Ls/Rs are the rear surrounds and Sl/Sr are the side surrounds (Nuendo’s naming scheme)

JUCE’s channel sets tells me that my plugin has the following channel order
L R C LFE Lss Rss Tfl Tfr Trl Trr Lrs Rrs

I can see that the AudioChannelSet stores the channels as bits in a juce BigInteger, but why is this?
This causes problems when trying to represent the DAW’s routing in the plugin, as I now have to worry about rearranging the channels internally.

Would it not be possible to store the channels as an array, to preserve the order?

Also, could the getAbbreviatedChannelTypeName() function take the DAW into account too?
(left side surround currently gets named as “Lss” in Nuendo, it should be “Sl”)

I don’t know the answer re: order of the channels, but in computer science terms, a set is an unordered collection by nature. You can’t depend on the order of items in a class named Set.

The channels are exposed through the plugin API, which in itself might even be differently from the order the host displays it to the user.

Even more, in Logic the user can specify the preferred order of the channels
Screenshot 2023-07-04 at 22.25.40

You wouldn’t expect the order in your plugin to change with that setting?

But apart from that, it was discussed before in this thread:

You wouldn’t expect the order in your plugin to change with that setting?

I feel like I personally would though, but as kerfuffle says, a “set” doesn’t have an implicit order
I’ll have to find a work around then, thanks

I had to write a remapper using code from the plugin format dependent maps that JUCE applies for VST3 and AAX (I didn’t do AU yet but it should be simple enough). AAX required some copy/pasting of some code, which seems messy.

As daniel says, there is no guaranteed that the order they arrive at the plugin (pre-JUCE remapping) is the same as the order in the track in the DAW. This is highly frustrating as soon as you want to work with anything outside that standard layouts. Hopefully plugin API people will add to this soon. The way VST2 worked was essentially ideal.