How to get option to choose stereo/mono version in host

I have not too much experience with other hosts. But in Logic Pro X for most plugins, when I try to insert it on tracks insert slot I have option to choose stereo version or mono.
How to achieve such option?

I wonder maybe I should just compile two versions of my plugin. But how to tell hosts it’s the same plugin but with two configurations to choose?
At all I think it’s not good solution. But maybe I am wrong?

How to make it properly? Could anyone give some advice?
For any help thanks in advance.

What does your custom AudioProcessor::isBusLayoutSupported() look like? That’s where you tell the host what channel I/O configurations you’re capable of supporting.

Here’s a short example for a mono plugin:

bool myPlugin::isBusesLayoutSupported(const BusesLayout& layouts) const
    // This checks if the input layout matches the output layout
    if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet())
        return false;

    // This plugin is mono only!
    if (layouts.getMainOutputChannelSet() != juce::AudioChannelSet::mono())
        return false;

    return true;

To get stereo you would obviously change that conditional to check for mono or stereo layouts… but you can basically implement whatever logic you want in there like supporting a layout that is 1 input with 2 outputs or something similar.

If you don’t want to use that there’s also the Projucer “Plugin Channel Configurations” field where you can simply write the supported input/output counts directly. For example, supporting mono and stereo would look like this in the “Plugin Channel Configurations” text entry:

{1, 1}, {2, 2}

If you’re using the Projucer field for setting “Plugin Channel Configurations”, you can just leave the AudioProcessor::isBusLayoutSupported() method alone.