Logic multi bus: never disables extra buses?

I’m making an instrument plugin that can have 1 stereo output or 8 stereo outputs. I’ve got this working by supplying 8 stereo outputs to the AudioProcessor constructor, and making isBusesLayoutSupported() return true when the number of outputs is either 1 or 8.

But I noticed that when I instantiate the plugin in Logic 11.0.1 as “Stereo” (i.e. the single-out version), the BusesLayout returned by getBusesLayout() has 8 channels, and they are all stereo, not disabled.

This is surprising. Does this mean that I can’t discover whether I’ve been instantiated in 1 or 8 output mode? That will mean that I can’t indicate in my UI whether you’re in a multichannel configuration, which isn’t ideal. Or am I missing something about how this should work?

Aha. In typical fashion I figured this out shortly after posting. You need to override canAddBus() and canRemoveBus() to return true to allow different bus layouts to be applied (even if it just happens at startup, and isn’t truly dynamic).

The crossover between these methods does feel slightly strange with isBusesLayoutSupported(). You would think that method would cover both cases. It’s also strange that I must return true for canRemoveBus() even when that would result in a layout that would fail isBusesLayoutSupported() - but we’re “on the way” to a layout which is supported.

Overall I find the ‘probing’ nature of the buses API quite inscrutable to work with, but that’s the plugin API’s fault, not JUCE’s, so now I’m just rambling into the ether again!

Hmm, turns out I’m not really done with this. It seems that if I make canAddBus() or canRemoveBus() return true ever then I don’t get the bus count I want - Logic always shows (depending on the channel layouts I allow) “Stereo”, “Multi-Output (16xStereo)” and “Multi-Output (25xStereo)”. It does then hand me the amount of buses I was instantiated with.

If I make those functions always return false, then it shows just “Stereo” and “Multi-Output (NxStereo)” (where N is the actual number of buses I declare, which might be any number from 2 to 25). But in that case, I can’t tell when I was instantiated as just “Stereo”, because Logic always gives me N buses, and they’re all enabled. So I can’t disable Multi-Out UI options in my plugin because I don’t know I was instantiated as Stereo.

I’d like the second behaviour, but with some way of knowing if I’m instantiated without the Multi-Output option. Does anyone know if that’s possible?