VST 2.4 setNumInputs question

DSP, Plug-in and Host development discussion.
camsr
KVRAF
6890 posts since 17 Feb, 2005

Post Sun Jan 07, 2018 11:12 pm

In one of my plugins, I setNumInputs(4) to enable a stereo sidechain input. Some hosts don't support sidechains and, my guess, is they 'somehow' limit the number of channels a plugin will use.

Is there some agreed procedure that a host will provide, for the case of the plugin's process() reading the inputs that they are not using? Is there a NULL pointer provided, or a valid buffer with zeroed data? And should I be checking the input buffer pointers for NULL?

For example, FL Studio copies the inputs[0:1] buffers (stereo pair) to the other inputs. That results in the sidechain being the same data as the base stereo input.
Image

mystran
KVRAF
5043 posts since 12 Feb, 2006 from Helsinki, Finland

Re: VST 2.4 setNumInputs question

Post Tue Jan 09, 2018 3:02 am

camsr wrote: For example, FL Studio copies the inputs[0:1] buffers (stereo pair) to the other inputs. That results in the sidechain being the same data as the base stereo input.
FL (since 9 or 10 or something) supports "arbitrary" number of inputs/outputs, it just defaults to all inputs being connected to the "normal" signal on the channel. That's why you see the same signal, but you can map something else there from the properties panel.

Other than that, you should generally be able to expect a valid buffer for every input or output, which I guess is just about as much as you can expect. There might still be some hosts around though that get upset for multiple inputs (or outputs), so you might have to compile another version without a side-chain.

Maybe someone else can give a better overview of the situation with different hosts, but like.. it's not something that is very well supported in VST2.
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

camsr
KVRAF
6890 posts since 17 Feb, 2005

Re: VST 2.4 setNumInputs question

Post Tue Jan 09, 2018 4:10 pm

Thanks mystran.

I was thinking if VstPins had anything to add in this situation. I still haven't gleaned what they actually do (from experience with only 2 daws) from the sdk source, but they seem to add dynamic channel management?
Image

mystran
KVRAF
5043 posts since 12 Feb, 2006 from Helsinki, Finland

Re: VST 2.4 setNumInputs question

Post Fri Jan 12, 2018 1:42 pm

To be honest, I never figured out any of the complicated channel management stuff, and instead I just implement the following to return stereo pairs (so the host knows to group my channels in pairs and the names make a bit more sense):

Code: Select all

bool VST2Plugin::getInputProperties(VstInt32 index, VstPinProperties * prop)
{
        if((unsigned) index >= 2*plug->getInputCount()) return false;
        sprintf(prop->label, (!(index&1)) ? "L%d" : "R%d", index>>1);
        prop->flags = kVstPinIsActive | kVstPinIsStereo;
        return true;
}

bool VST2Plugin::getOutputProperties(VstInt32 index, VstPinProperties * prop)
{
        if((unsigned) index >= 2*plug->getOutputCount()) return false;
        sprintf(prop->label, (!(index&1)) ? "L%d" : "R%d", index>>1);
        prop->flags = kVstPinIsActive | kVstPinIsStereo;
        return true;
}
Empirically this seems to do just about the right thing for a bunch of stereo inputs/outputs.
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

Return to “DSP and Plug-in Development”