Issues with sidechain channel configuration in VST3 / Cubase

Cubase seems to always use the default channel count for sidechains no matter what the input/output configuration is.

For example, in a plugin that supports {1->1, 2->2}, we want the sidechain to match the input channel count (i.e. mono for 1->1, stereo for 2->2). However, Cubase never gives us the opportunity to do this and instead checks a very sparse set of options in isBusesLayoutSupported.

If we specify {1, 1, 1} (in, out, sidechain) as the default during construction, it will try the following when loaded on a stereo track:

channel config: {2, 2, 1} - rejected because we want stereo sidechain
channel config: {1, 1, 1} - not ideal, track is stereo!

If we specify {2, 2, 2} (in, out, sidechain) as the default, it will try the following when loaded on a mono track:

channel config: {1, 1, 2} - rejected because we want mono sidechain
channel config: {2, 2, 2} - not ideal, track is mono!

These are both wrong in different ways. Unlike other hosts (e.g. Pro Tools) Cubase can support both stereo and mono sidechains, so we suspect this is a JUCE wrapper issue. Other plugins (like FabFilter) are able to support {1, 1, 1} and {2, 2, 2} in Cubase.

Using latest JUCE master, Cubase 10.5, VST 3.6.14 SDK

As far as I can tell, Cubase will always use only the speaker arrangement reported in getBusArrangement() for sidechains. I can’t see anything obviously amiss in the JUCE VST3 wrapper that could be causing this and it could be that the plug-ins which appear to support dynamic sidechain channels are using workarounds to achieve this. Would a viable workaround be to set the default sidechain channel layout to the maximum you need (in your case stereo) and then ignore the second sidechain channel in your processing code if the plug-in is on a mono track?

Thanks for taking a look.

Reporting the maximum is not really a great workaround for us because then the sidechain must also use that maximum number of channels. For something like a 5.1 surround plugin, I’m not sure which channels we’d want to ignore to get the correct behavior when the plugin is on a mono track.

Does JUCE support dynamic channel layouts in a way that could be leveraged into a fix?

I think something must be missing. These are sends from a mono track to a JUCE effect on a mono (1) and a stereo (3) track, and a non-JUCE effect on a mono (2) and a stereo (4) track. In mono-to-mono, Cubase shows a send panner for the JUCE effect, and none for the other. So defaulting to 6 channels, I think it would use a 5.1 panner, which is very inconvenient.

Yeah, I think it would result in a 5.1 panner in the surround case as well — definitely not ideal.

Something I noticed is that when a mono plugin is sidechained from a mono track and a stereo track at the same time, the stereo track send gets a panner and the mono track send doesn’t -both channel configurations are used simultaneously. (For a stereo plugin, both get a panner). I tried setting two separate buses, one mono and one stereo, but it always uses the first one.