Page 1 of 1

Issues with sidechain channel configuration in Cubase

Posted: Mon Mar 30, 2020 5:56 pm
by goodhertz
Using a plugin created with JUCE, 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 always uses only the speaker arrangement reported in getBusArrangement() for sidechains. Is there a workaround for this?

Please see the JUCE forum post for more information: https://forum.juce.com/t/issues-with-si ... base/38134

Re: Issues with sidechain channel configuration in Cubase

Posted: Fri Apr 03, 2020 11:20 am
by ygrabit
Cubase tries to set for the main buses only its wanted bus Arrangements. If the Plug-in Returns kResultFalse, then the host has to ask the Plug-in for ist wanted (or possible) Arrangements.

The plug-in has to adapt its buses itself like this for example:

Code: Select all


//------------------------------------------------------------------------
tresult PLUGIN_API AGainWithSideChain::setBusArrangements (SpeakerArrangement* inputs, int32 numIns,
                                                           SpeakerArrangement* outputs,
                                                           int32 numOuts)
{
	// the first input is the Main Input and the second is the SideChain Input
	if (numIns == 2 && numOuts == 1)
	{
		// the host wants Mono => Mono (or 1 channel -> 1 channel)
		if (SpeakerArr::getChannelCount (inputs[0]) == 1 &&
		    SpeakerArr::getChannelCount (outputs[0]) == 1)
		{
			auto* bus = FCast<AudioBus> (audioInputs.at (0));
			if (bus)
			{
				// check if we are Mono => Mono, if not we need to recreate the buses
				if (bus->getArrangement () != inputs[0])
				{
					removeAudioBusses ();
					addAudioInput (STR16 ("Mono In"), inputs[0]);
					addAudioOutput (STR16 ("Mono Out"), inputs[0]);

					// recreate the Mono SideChain input bus
					addAudioInput (STR16 ("Mono Aux In"), SpeakerArr::kMono, kAux, 0);
				}
				return kResultOk;
			}
		}
		// the host wants something else than Mono => Mono, in this case we are always Stereo =>
		// Stereo
		else
		{
			auto* bus = FCast<AudioBus> (audioInputs.at (0));
			if (bus)
			{
				tresult result = kResultFalse;

				// the host wants 2->2 (could be LsRs -> LsRs)
				if (SpeakerArr::getChannelCount (inputs[0]) == 2 &&
				    SpeakerArr::getChannelCount (outputs[0]) == 2)
				{
					removeAudioBusses ();
					addAudioInput (STR16 ("Stereo In"), inputs[0]);
					addAudioOutput (STR16 ("Stereo Out"), outputs[0]);

					// recreate the Stereo SideChain input bus
					addAudioInput (STR16 ("Stereo Aux In"), SpeakerArr::kStereo, kAux, 0);

					result = kResultTrue;
				}
				// the host want something different than 1->1 or 2->2 : in this case we want stereo
				else if (bus->getArrangement () != SpeakerArr::kStereo)
				{
					removeAudioBusses ();
					addAudioInput (STR16 ("Stereo In"), SpeakerArr::kStereo);
					addAudioOutput (STR16 ("Stereo Out"), SpeakerArr::kStereo);

					// recreate the Stereo SideChain input bus
					addAudioInput (STR16 ("Stereo Aux In"), SpeakerArr::kStereo, kAux, 0);

					result = kResultFalse;
				}

				return result;
			}
		}
	}
	return kResultFalse;
}