isBusesLayoutSupported: Checking number of I/O channels causes channel data swap in audio buffer

Hi, I’m developing a multichannel FX processor on Windows, which can handle up to 8 channels of I/O. I’m using isBusesLayoutSupported so the host can check what channel layouts are supported.

If I write the following:

bool MyPluginProcessor::isBusesLayoutSupported(const BusesLayout& layouts) const
{
    juce::AudioChannelSet inputChannels = layouts.getMainInputChannelSet();

    if (inputChannels.size() > 8)
        return false;

    return true;
}

Reaper limits the number of input channels to 8, and when sending a test signal into each input I get the audio data on the correct channel in processBlock.

I also want to limit the number of outputs to 8, but if I write either:

bool MyPluginProcessor::isBusesLayoutSupported(const BusesLayout& layouts) const
{
    juce::AudioChannelSet inputChannels = layouts.getMainInputChannelSet();
    juce::AudioChannelSet outputChannels = layouts.getMainOutputChannelSet();

    if (inputChannels.size() > 8 || outputChannels.size() > 8)
        return false;

    return true;
}

or:

bool MasteringPluginProcessor::isBusesLayoutSupported(const BusesLayout& layouts) const
{
    juce::AudioChannelSet inputChannels = layouts.getMainInputChannelSet();
    juce::AudioChannelSet outputChannels = layouts.getMainOutputChannelSet();

    if (inputChannels.size() > 8)
        return false;

    return inputChannels == outputChannels;
}

Reaper correctly limits my plugin output bus to 8 channels, but when sending a test signal into each input, the audio data supplied to processBlock has channels 4 & 5 swapped with channels 6 & 7!

I have tested a number of variations of this code, and it seems whenever I check both the input and output channel counts, I get the same weird result. I am not changing anything apart from the code you see.

The same bug happens if I specify {2,2}, {8,8} in Projucer’s Plugin Channel Configurations

I am initialising the channel layout as follows, but it doesn’t seem to make a difference if I use AudioChannelSet::stereo(), for example.

MyPluginProcessor::MyPluginProcessor() :
    AudioProcessor (BusesProperties().withInput("Input", juce::AudioChannelSet::create7point1(), true)
                                     .withOutput("Output", juce::AudioChannelSet::create7point1(), true))

And this is the channel configuration in Reaper:

Anyone else experienced something like this? Not sure if it’s JUCE or Reaper, but I don’t have another multichannel DAW to test…

EDIT: The issue doesn’t appear to happen in AudioPluginHost, so it might be Reaper specific.