JUCE 4.3.0: AudioProcessor::setchannelLayoutOfBus failing to switch hosted Kontakt instance from stereo to 32 output

Using JUCE 4.3.0 - in an attempt to switch a newly created instance of a Kontakt 5 AudioUnit plugin in my host code from stereo outs ( its default state ) to 32 outs using setPlayConfigDetails it seems that setchannelLayoutOfBus() is returning a false.

I’m passing in the following :

newNumIns : 0
block size 512
samplerate 44100

the code in setchannelLayoutOfBus returns false here
( the test : layouts.getChannelSet (isInputBus, busIdx) == layout. fails )

    if (layouts.getChannelSet (isInputBus, busIdx) == layout)
        return applyBusLayouts (layouts); 

    return false;

Fabian - any ideas ?

Could it be that Kontakt doesn’t support 32 output channels on it’s main bus. Are confusing the total number of channels with the number of channels on the main bus?

The old setPlayConfigDetails will only attempt to change the number of channels on the main bus. Try adding more buses with AudioProcessor::addBus method. I think Kontakt supports an infinite number of buses.

[Could it be that Kontakt doesn’t support 32 output channels on it’s main bus?]

I did - as you might recall have my own stab at modding OSX CoreAudio API code to JUCE to switch AU’s from 2 ch to 32 or 64 ch ( mono ) but was a long while ago and can’t recall.

But can I take it that the way you’ve very recently in the last few days modified the JUCE HOST example on the “develop” branch of GIT to recall a graph that has a multichannel kontakt instance - is the “definitive” way to code for the 4.3 plugin hosting API going forward ?

If so - i’ll modify my code to reflect that. But it does leave open how to interpret “old setPlayConfigDetails” in 4.3

is it to be deprecated ? Is there now a definitive document somewhere stating how we should code for multi-bus hosting going forward ?

I seem to recall that the threads here on the matter were a little “in flux” API-wise.

Yes, I think the setPlayConfigDetails should be and can be easily avoided. Instead of using setPlayConfigDetails you should be using AudioProcessor::setChannelLayoutOfBus. Some plug-ins allow you to add/remove buses such as mixer plug-ins or Kontakt. For these plug-ins you can dynamically add and remove buses with AudioProcessor::addBus and AudioProcessor::removeBus.

If we lived in a perfect world then the rule would be that you would only ever use a ridiculous channel number (like 32) if you really want 32-speaker surround sound. Otherwise you should be adding buses and each bus has the layout that you prefer (probably mono or stereo). Obviously, due to limitations of hosts and early versions of VST-2, 32-speaker surround sound format has been misused to “emulate” multiple buses. Hence there is a lot of confusion around this.