FR: Look up channel order received from host

Please can a plugin have the ability to look up the channel order the host provided before JUCE rearranged it?

When working in multichannel formats (in a plugin) different hosts/formats provide the channels in different orders and JUCE kindly rearranges everything so one can access the channels consistently by AudioChannelSet::ChannelType.

However, when you wish to visualise the audio, for example with 6 level meters for 5.1, it would be more intuitive for the user if the meters were displayed in the order they expect. If host-provided channel order could be looked up, that would give us a better chance of achieving this.

I understand there is no guarantee that the host-provided-order is the order the user expects (it might change depending on their DAW settings), but it would be a good place to start in offering an intuitive plugin GUI.

This has been mentioned before, but I’d like to get it in the feature requests category.

Related posts:

This would be great. Even better might be to give the option not to re-order the channels in the first place and instead to store the channel type. Then the current lookup methods would still work.

I’d very happily settle for this FR because then I could manually undo the JUCE reordering. I very often need to get the channels in the order they are in the DAW because it matters for the DSP processing.

I had a related question I was about to post but I feel this is implicitly answered above…

The question was that if any other orders than those supported by juce::AudioChannelSet are used in reality or by industries.
I had kind of assumed that because juce::AudioChannelSet is a bit mask and therefore the channels always in the same order that this is always the order the channels are represented in.

The above makes me think this is not the case.
Which would mean if we want to store a real order of channels we’d need an array/vector of juce::ChannelType which is a lot less space efficient (8 bits per channel) and can’t fit entirely in the inline storage of a juce::BigInteger (4 ints) which is what juce::AudioChannelSet uses internally.

Currently, if you are writing a plugin where the channel order does matter, I believe you do indeed have to store it as an array/vector. I am storing a map to lookup the index by the ChannelType as well.

Yes, you have to save them in an array/vector, but to get the original string values from the wrappers isn’t possible (I had to write my own utility).

The AAX wrapper has Arrays for the indexes and has functions like: juceChannelIndexToAax()

JUCE should have a public way to get the original order and getAAXSpeakerArrangementAsString()… for all wrappers.

Rail