In an audio plugin project, when clicking the “i” button next to plugin channel configurations says for plugins that accept sidechain inputs to override AudioProcessor: setPreferredBusArrangement(), which seems to be deprecated.
As well, are there any links to resources that discuss how to have multiple channel configurations that support sidechain inputs with Juce 5.0.2? There are so many posts out there that seem to be old and discuss deprecated code, bugs, etc, that I can’t seem to find a straight answer on how to go about it.
I think the best place to start is to have a look at the NoiseGate example in
JUCE/examples/PluginSamples/NoiseGate. In a nutshell:
- Keep the channel configuration field in the projucer empty. This field is for legacy code.
- Change your constructor so it supplies the number of buses and default channel configuration to the base-class AudioProcessor constructor (see line 36 in
- Override the
isBusesLayoutSupported callback to limit the channel configurations that your plug-in supports. Always returning
true in this callback means that your plug-in supports any channel configuration on any of it’s buses (for example 7.1 in on input, quadraphonic on the output etc.). See the example implementations of this callback in
JUCE/examples/PluginSamples. The NoiseGate example checks that the input and output layout is identical (i.e. if you are trying to gate 7.1 surround then the output of the plug-in will also be 7.1 surround). The side-chain can have any layout as it is mixed down to mono internally. Additionally, the plug-in checks that the main input bus is not disabled as that wouldn’t make much sense. The sidechain, however, can be disabled.
So the NoiseGate example is the official documentation of the multibus…?
I think now as the dust from the changes 4.0.1…4.3.1 … 5.0.0 settles, maybe provide a new rewritten official guide?
This information is already spread over old forum posts, different examples, different tutorials…
I understand that it is too much information for the doxygen documentation. So maybe provide a document, that is maintained? Could be just like the one you wrote for the initial version of the multibus, but not as a forum sticky, because when I come back to that information, I don’t want to read through 100+ posts…
Yes that’s a good idea. There is, of course, also this video:
Thanks for the detailed reply, it was extremely helpful. Are you guys open to submissions for your tutorials? One on the multibus API would be great for reference.
One question, in the Noise Gate example the sidechain input is set by calling
AudioSampleBuffer sideChainInput = getBusBuffer(buffer, true, 1); What if there is no bus with index 1?
You specify the number of buses in the constructor of your plug-in. Although the channel format (mono/stereo/surround 5.1/…) of the individual buses can change, the number of buses won’t change during the lifetime of the plug-in and therefore it’s safe to assume that there is always an input bus with index 1.
You can, however, disable/enable certain buses. This is a special channel format called
AudioChannelSet::disabled(), which has zero channels. So the noisegate code will still work even if the sidechain is disabled as it will iterate through zero channels.
Does this make sense?
That makes perfect sense. Thank you for the details!