At the moment, there is no possibility to change the amount of input and output channels in a JUCE-based VST plugin, because of the lines 360/361:
numInChans = JucePlugin_MaxNumInputChannels;
numOutChans = JucePlugin_MaxNumOutputChannels;
Why aren’t those:
numInChans = jmin(filter->getNumInputChannels(),JucePlugin_MaxNumInputChannels);
numOutChans = jmin(filter->getNumOutputChannels(),JucePlugin_MaxNumOutputChannels);
instead? Would this cause any problems? There are many VST’s that let you change the amount of inputs/outputs. For instance NI Battery.
This only works if I also declare AudioProcessor::getNumInputChannels() and AudioProcessor::getNumOutputChannels() as virtual functions.
Perhaps VST is a little bit different in that sense, that it does not grab the number of input/output channels from the host, but that it is the plugin that tells the host how many IO’s it has? In the JUCE docs it says that AudioProcessor::getNumOutputChannels(): “Returns the number of output channels that the host will be sending the filter.” At least in VST’s it seems to be the other way around.
Or maybe I am misunderstanding something. Fixing the number of inputs and outputs in the jucePluginCharacteristics.h seems like a limitation to me.
Perhaps one could add to AudioProcessor 2 functions called: getNumWantedInputChannels() & getNumWantedOutputChannels() which the host could ask to get the “wanted amount” of IO channels from the plugin? So this would be for hosts like VST hosts, that actually ask the plugin the number of channels it has.