is there a way to query how juce internally reorders the input and output channel to convert from the internal speaker layout to those used in the hosts, like Logic for example?
I want to check this to actually have my meters move on channel 1 when the hosts meter also moves on channel 1 etc. It is also important for me to know this because I want to provide the user a channel assignment feature for the inputs which of course must reflect the incoming channels.
JUCE channels are ordered using AudioChannelSet. You can query the AudioChannelSet for each bus from the AudioProcessor, and use AudioChannelSet::getTypeOfChannel(int) to find the kind of channel at a specific index in the bus.
I don’t think it necessarily makes sense to think about the ‘channel number’ in Logic. Instead, you should probably use the ‘channel type’ to differentiate channels. You can query the channel type of a particular channel using getTypeOfChannel, or find the index of a particular channel type using getChannelIndexForType.
In my case it makes sense. Otherwise I would not ask.
In the example I gave in my previous post, how could I implement multichannel metering which moves in the same way as the multichannel metering on the logic channel? Meaning, if channel 1 moves in the plugin it should also be channel 1 in Logic, etc…
And metering is just an example.
By trying to take off the burden of thinking about channel order of the Juce user through this channel reordering abstraction layer, this problem now arises. Except I could switch off the reordering or get the info about which channel nr. in Juce is mapped to which channel nr. in Logic/Protools/etc…
Another problem is also that in certain layouts the azimuth values of L and R are 30° or -30°, while in others 45° and -45°. The channel type is not telling me anything about that. So I need to create a solution for that by myself to have correct rendering.
There’s no way to do this. The channel order that Logic displays in its UI does not correspond to the channel order that is passed to the plugin’s processing callback, and there’s no way to query the order in which channels are displayed in the host UI.
Instead, a better approach is to pick a channel order that you want to use in your plugin (e.g. LS L C R RS LFE) and then to use getChannelIndexForType to find the index of the channel with a particular type. As long as the channel meters are labelled clearly, the channel ordering will be obvious to the user.
I checked out a couple of 5.1 AU plugins in Logic. FabFilter ProQ 3 displays the channels in the order L C R LS RS LFE, and Izotope Neutron 3 uses L R C LS RS LFE. Both of these layouts differ from Logic’s built-in Level Meter, which uses LS L C R RS LFE. In all cases, the interface is easy to understand because the meters are clearly labelled.
Unfortunately I don’t think there’s a way to query the speaker locations/angles using the current JUCE API.
So if i understand this correctly, Logic/AU is not communicating to Juce any kind of channel numbers associated with channel types, such as left, right etc.?
I know that I currently have no way of knowing anything about what Logic does from within the process callback or any other part of my PluginProcessor implementation. Thats why I ask. I also have the problem on the input side. On the input side the user of my plugin can choose what to do with each input channel, by number, not by name…
AU hosts pass the channels in an order specified by a channel tag, e.g. kAudioChannelLayoutTag_MPEG_5_1_A (L R C LFE LS RS). This channel layout is not guaranteed to match the layout displayed in the host’s UI. As far as I’m aware, there’s no way to query the channel number/order that a host uses in its UI.
Yes; look at the documentation for AudioChannelSet. You can use getChannelTypes to find the types of the channels in the set, and their orders. You can also use getTypeOfChannel to find the type of a channel at a particular index; and getChannelIndexForType to find the index of a channel with a particular type.
The ordering is consistent across hosts and plugin formats. A 5.1 layout will always use the order L R C LFE LS RS.
@reuk Ok, got it. Well originally i wanted to make everything line up correctly, metering, input selection and output format. Since that idea just fell apart with the Logic meters having nothing to do with the actual channels I have to look for another way to do what I want without knowing the external format. But thanks for digging into this.
I would go the same route and offer the user those choices, so they can select their preferred order.
Just save it in a PropertiesFile rather than in the plugin instance, so it becomes a global setting for your plugin.
Nah, since this only makes sense for Logic, not worth the effort. Other DAWs don’t care about this or do it another way so I do not want to create too much dependency on DAW specifics. The plugin I am developing is already complex.
@reuk Ok, so i am doing some further testing with Logic and hell, things seem to be wrong. Here it comes:
LCRS in Logic is identified as Quadraphonic
6.1 (ES/EX) in Logic is identified as 7.0 Surround
7.1 (SDDS) in Logic is identified as 7.1 Surround
5.1.2 in Logic is identified as 7.1 Surround
5.1.4 in Logic is identified as Discrete #10
7.1.2 in Logic is identified as Discrete #10
7.1.4 in Logic is identified as Discrete #12