VST2 always uses default buses layout

Hello guys,

I’m working on a multichannel audio effect plugin and I observed that VST2 always uses the plugin’s default buses layout. Additionally isBusesLayoutSupported() never gets called when the plugin has least 2 input buses.

You can reproduce this with the following steps (I tested on Windows 10 with JUCE 6.0.3 and Reaper 6.14):

  1. Create a new plugin in Projucer.

  2. Add 3 buses in PluginProcessor’s constructor by creating the BusesProperties by

            .withInput("Input", AudioChannelSet::stereo(), true)
            .withInput("SideChain", AudioChannelSet::stereo(), true)
            .withOutput("Output", AudioChannelSet::stereo(), true);
  1. Load the VST2 plugin on a track in Reaper.

  2. Show the used AudioChannelSets on gui by adding the following code to PluginEditor’s paint method:

const auto* mainInputBus = audioProcessor.getBus(true, 0);
const auto* mainOutputBus = audioProcessor.getBus(false, 0);
const auto* sideChainBus = audioProcessor.getBus(true, 1);

auto mainInputBusAudioChannelSet = AudioChannelSet{};
auto sideChainBusAudioChannelSet = AudioChannelSet{};
auto mainOutputBusAudioChannelSet = AudioChannelSet{};
auto mainInputBusInfo = String{};
auto mainOutputBusInfo = String{};
auto sideChainBusInfo = String("No sidechain");

if (mainInputBus && mainOutputBus)
    mainInputBusAudioChannelSet = audioProcessor.getBusesLayout().getMainInputChannelSet();
    mainOutputBusAudioChannelSet = audioProcessor.getBusesLayout().getMainOutputChannelSet();
    mainInputBusInfo = "MainInputBus = " + mainInputBusAudioChannelSet.getDescription();
    mainOutputBusInfo = "MainOutputBus = " + mainOutputBusAudioChannelSet.getDescription();

if (sideChainBus)
    sideChainBusAudioChannelSet = audioProcessor.getBusesLayout().getChannelSet(true, 1);
    sideChainBusInfo = "SideChainBus = " + sideChainBusAudioChannelSet.getDescription();

juce::Font font(15.f);

auto x = 5;
auto y = 5;

g.drawFittedText(mainInputBusInfo, x, y, font.getStringWidth(mainInputBusInfo),
    fontHeight, Justification::left, false);

y += roundToInt(1.1 * fontHeight);
g.drawFittedText(sideChainBusInfo, x, y, font.getStringWidth(sideChainBusInfo),
    fontHeight, Justification::left, false);

y += roundToInt(1.1 * fontHeight);
g.drawFittedText(mainOutputBusInfo, x, y, font.getStringWidth(mainOutputBusInfo),
    fontHeight, Justification::left, false);
  1. As expected the gui shows the AudioChannelSets of main input / output and sidechain buses configured as “stereo”.

  2. Now change the number of track channels (e.g. from 2 to 4 or to 6) in Reaper’s track routing dialog “Route”.

  3. The gui shows the AudioChannelSets of main input / output and sidechain configured as “stereo” - but it should be “1st Order Ambisonics” resp. “5.1 Surround” or something like that.

  4. Also the number of channels of the delivered audio buffer in processBlock() has 4 channels (2 main input / output channels + 2 sidechain input channels) instead of 8 resp. 12 channels.

  5. Furthermore, the PluginProcessor’s method isBusesLayoutSupported() never gets called.

  6. It is also astonishing that after removing the SideChain bus the method isBusesLayoutSupported() is called, but it always returns false when using the default JUCE code.

After changing the number of track channels in Reaper I would expect the methods AudioProcessor::setBusesLayout() resp. AudioProcessor::audioIOChanged() to be called (that’s what VST3 does). But this does not happen in VST2.

Am I doing something wrong?

Thank you in advance.

1 Like

Did you test it only in reaper?
If that’s the case I’m pretty sure reaper always use the default layout. But on Studio One or Cubase this is not the case.

Reading more of your code. Keep in mind vst2 doesn’t have the concept of busses.

Yes, I did test it only in Reaper. My plugin is able to process multichannel / surround audio. And it can handle (multichannel) sidechain. Because Cubase doesn’t support sidechain in VST2 and Studio One doesn’t provide surround Reaper was my first choice. (BTW: Are there any other DAWs that can handle both: multichannel surround + multichannel sidechain? Apparently Cubase can only do stereo sidechain.)

I know that VST2 doesn’t have the concept of buses. But my plugin can be bombarded with multiple channels by the DAW. Either the plugin does not update it’s layout or the host does not send a command to use a new layout. I’m afraid that something gets lost in the juce_VST_Wrapper on the way between DAW and plugin.