JUCE Plugins show max. chan. conf, but uses default channel conf. internally

I have a JUCE 4.3 Plugin VST2 which has no channel limitation, but uses a default channel configuration of stereo/stereo

No if i open this in a JUCE 4.0 hosts it, it will open with 8/8 channel configuration, but uses internally the 2/2 channel configuration.

I thought the default channel configuration, is a fallback, to open the plugin in older hosts, with the correct number of channels, but its seems it does not work. This must be fixed.

1 Like

So in older hosts, the number of vstEffect.numInputChannels/numOutputChannels reports the number of current channels, i tried this, but still get crashes when insert this kind of plugin as a surround plugin, it seems that internal buffer are not big enough? Maybe someone with deeper wrapper knowledge (@fabian) knows what to do?

So, the problem is, the default channel number makes no sense, when older hosts open the plugin with the maximum number of channels (I thought this have been fixed), but the plugin thinks it has the default number of channels.

diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
index 37f4f3f..e109062 100644
--- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
+++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
@@ -297,8 +297,8 @@ public:
     vstEffect.getParameterValueFunction = getParameterCB;
     vstEffect.numPrograms = jmax (1, af->getNumPrograms());
     vstEffect.numParameters = af->getNumParameters();
-        vstEffect.numInputChannels = maxNumInChannels;
-        vstEffect.numOutputChannels = maxNumOutChannels;
+        vstEffect.numInputChannels =  filter->getTotalNumInputChannels();  //   maxNumInChannels;^M
+        vstEffect.numOutputChannels =  filter->getTotalNumOutputChannels(); //  maxNumOutChannels;^M
     vstEffect.latency = filter->getLatencySamples();
     vstEffect.effectPointer = this;
     vstEffect.plugInIdentifier = JucePlugin_VSTUniqueID;
@@ -547,7 +547,7 @@ public:
     {
         isProcessing = true;
 
-            const size_t nInAndOutChannels = static_cast<size_t> (vstEffect.numInputChannels + vstEffect.numOutputChannels);
+            const size_t nInAndOutChannels = static_cast<size_t> (maxNumInChannels + maxNumOutChannels );^M
         floatTempBuffers .channels.calloc (nInAndOutChannels);
         doubleTempBuffers.channels.calloc (nInAndOutChannels);
 
@@ -1439,7 +1439,7 @@ private:
 
     if (filter != nullptr)
     {
-            const int nInputAndOutputChannels = vstEffect.numInputChannels + vstEffect.numOutputChannels;
+            const int nInputAndOutputChannels = maxNumInChannels + maxNumOutChannels ;^M
         tmpBuffers.tempChannels.insertMultiple (0, nullptr, nInputAndOutputChannels);
     }
 }

And thats how my plugin with the latest juce (develop) look like, with the old juce 4.0 host (there are lot of hosts the behave like that) with a default channel configuration stereo/stereo

That’s odd. If you have set the default layout in the AudioProcessor constructor then the host demo will use that. Try the GainPlugin demo in JUCE/examples/PluginSamples/GainPlugin. This will appear as a stereo-in/stereo-out plug-in by default.

I’m talking about older Plugin Hosts, which do not support multiple Configuration, like that one in JUCE_4_0
But the same goes for a lot for other hosts.

(Isn’t that the reason why we have the Default Channel-Configuration? )

The problem is, either the plugin be opened with the full number of channels AND report the full number of channels in the plugin internally (which can be limited with isBusesLayoutSupported)

OR

it should be opened with the default number of channels AND report the number of default channels internally to the plugin

But the current behavior is, it opens the number of maximum of channels (because thats what is reported to the host), and opens the plugin Internally with then default number of channels.

This breaks all old hosts, which do not support multiple channel configurations. The old behavior was more consistent.

So at least, the number which is used internally must be the same, which the hosts is seeing.

(I could live with that, even if its not the default number of channels)

The problem is that vstEffect.numInputChannels and vstEffect.numOutputChannels needs to be the maximum number of channels. So I don’t understand what you propose. If I make those numbers any smaller then there is no way to increase the channel number beyond the default.

the problem is, that older hosts which open the plugin with maximum of channels (like juce 4.0), do not realize that the plugin is only working with a smaller number of channels internally.

Not sure what we can do…

Maybe i just use the default number of channels = the maximum number channels for VST

(I hoped that this behavior had been fixed with the latest juce)

Another option is that your plug-in checks if it is loaded as VST2 and limits the layout to the default layout via isBusesLayoutSupported.

mhh, but than again, it wouldn’t support more than the number of default channels, in VST2 hosts that support multiple channel configurations (or better less than maximum) like Cubase (which was always working, even with older juce releases)

Yup, I think that’s the trade-off.