Multi Input Plugin: How to process?

Hi everyone,

Having never worked with multi channel plugins before I wanted to create a simple test plugin that would allow me to route n channels into the plugin for multi processing.

A use case using Ableton would be to insert the plugin on a channel and route other channels into this using its ‘AudioTo’ drop down.

Screen Shot 2021-09-19 at 8.08.30 am

Following this tutorial (JUCE: Tutorial: Configuring the right bus layouts for your plugins), my understanding is that I needed to explicitly identifier the number of channels in the AudioProcessor constructor, like so:

Screen Shot 2021-09-19 at 7.34.28 am

This shows up in Ableton as a possible channel within the plugin to route into…

My confusion is within the process block. What is a recommended way of individually processing the input samples of each channel?

You can look at AudioProcessor::getBusBuffer() – you specify a bus number and whether the desired bus is an input or output, and it returns a sub buffer with only the channels for that bus.

Thanks Ben.

Yes, I’ve looked at this previously.

For testing, here is my attempt at changing the gain of the first channel (left 10%, right 100%), which works.

Screen Shot 2021-09-19 at 8.25.36 am

However, when I select another channel from the Ableton dropdown, I would expect the gain to go back to its nominal level (L: 100%, R: 100%). Changing the input channel into the plugin doesn’t affect anything.

I’m a bit unclear on what behavior you’re expecting to see?

In the code you posted above, you’re always taking the main input bus, applying a gain, and writing it to the output. Regardless of how you route audio into your plugin in Ableton, your code is writing to the output the samples from the main input bus. If you change the last arg of the getBusBuffer call from 0 to 1, then you should hear your sidechain input being passed through.

Also, to avoid confusion, I usually do something like this:

auto output = getBusBuffer (buffer, false, 0); 
auto input = getBusBuffer (buffer, true, busNum);

Now, input and output may refer to the same memory regions of the original process block buffet, but they may not.

My assumption is that with a multi channel plugin, I’m able to select an input destination of the plugin (in this example, via the dropdown option Ableton provides), process this input source independently and then route this to the output of the host’s channel. This is how NI Reaktor works, yet with MIDI.

Screen Shot 2021-09-19 at 1.07.35 pm

Screen Shot 2021-09-19 at 1.11.59 pm