Request: Changeable amount of inputs/ouputs in VST's


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.


As I understand it, VSTs have a max number of channels but the actual number can change dynamically, whereas AUs and RTAS publish the different channel configurations that they support, and the host opens one when it loads. So I fixed it to make it work on all these setups. Not sure I exactly follow what you’re suggesting here, but would it break the model used by AU/RTAS?


Not really, they have a fixed amount of channels. Each time the host loads a plugin, he asks for the amount of channels and then processes all those channels (well he theoretically can process less, but that’s not the way it is meant to be). So if you choose in your NI Battery 16 channels as output, Cubase will display 16 channels as output in the mixer.

What did you change exactly in the VST wrapper code? Lines 360/361 didn’t change atleast.


I didn’t mean I changed it just now, I mean that’s how I designed it originally. I think you can change the number of channels though - it just involves sending a change message to the host to tell it that something has changed.


Ok, and how does one do that without modifying the code as I described?


Oh, I didn’t mean that the wrapper code could do it, just that VST was capable of doing it. As no other plugins formats support that, I’m not keen on adding it to the processor class.


So you think it´s better to just let it as it is with a hardcoded number of channels for VST plugins - VST being one of the 2, if not the major plugin formats out there?


…well, it’s annoying, but as a lowest-common-denominator format, that’s the most reliable. If I had time, I’d look into this more deeply, as there might be a good solution that makes it more flexible, but too many other things on my plate right now…


Ok, I´ll then keep my code for now. I think for 3 lines of change it does pretty well what it´s supposed to do anyway…