How to get speaker layout used by the host

Is there an easy way to obtain the speaker order used by the host? JUCE seems to remap the speaker order, which is perfectly fine. However, it’s sometimes necessary to know the channel order used by the host, e.g. for displaying lever meters with a speaker order that matches the host.

In a plugin context you can use AudioProcessor::getChannelLayoutOfBus (isInput, index)

From there you can use AudioChannelSet::getTypeOfChannel (index) and AudioChannelSet::getAbbreviatedChannelTypeName (channelType)
or getSpeakerArrangementAsString()

Thanks, Daniel! Unfortunately, this returns the JUCE internal speaker order. If I choose “L C R Ls Rs LFE” in Pro Tools, I still get “L R C Lfe Ls Rs” when I call getSpeakerArrangementAsString as you describe. My problem is how to obtain the speaker order used in the host application so that the level meters correspond.

Oh I see, I’m sorry. I read that you were talking about the remapping, but didn’t quite understand the use case.
Yes, that makes sense… Unfortunately at the moment the only idea I can come up with (you probably thought about that yourself already) to code it manually using the PluginHostType::HostType.
Maybe somebody else has a better idea…

You must be very careful while applying any solution because sometimes
many forum members are not able to answer the question but still they
answer it anyhow. So, It’s important to confirm the solution and then apply it.

Anything useful for the topic though? :wink:

Thanks for the suggestions. Pro Tools offer different ordering of the speakers even for the same surround format (e.g. different 5.1 versions), so it looks as if this is actually not possible with JUCE at the time being. Maybe someone from ROLI could confirm? There are some methods for channel mapping in juce_AAX_Wrapper.cpp, but these aren’t public. It would be great if AudioProcessor could expose a method like “getHostSpeakerLayout” or similar.

Something else to throw into the mix on this, Nuendo swaps the rear/side channel pairs around relative to the Dolby format, it would be useful to be able to accommodate things like this as well.

Does this mean that you’re working on a surround reverb, Matt? :wink:

1 Like


1 Like