VST instrument multiple in and out
I want to create a VST instrument that has 16 MIDI inputs and at least 16 audio outputs. Similar to how kontakt or halion do开发者_Go百科 this.
Any ideas?
As @leftaroundabout noted, it's unlikely that you need 16 inputs and outputs, especially for an instrument. However, having 16 MIDI inputs and 16 audio outputs is very common for drum machines and other multitracked instruments where the user might want to process each voice individually. Audio inputs in general are not particularly useful for instruments as a whole.
That said, you simply instantiate your plugin like so:
MyPlugin::MyPlugin(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, 0, kNumParameters) {
if(audioMaster) {
setNumInputs(0);
setNumOutputs(16);
}
// other constructor stuff ...
}
That's your starting point. However, since the vast majority of plugins are stereo only, there is a bunch of other work you will need to do to get the host to deliver you 16 output channels (assuming it supports it). You will likely need to call getSpeakerArrangement()
and setSpeakerArrangement()
at some point, and also override getOutputProperties()
.
As for the MIDI channels, the host should not treat them any differently than normal. You will be delivered regular MIDI events, in the form of VstMidiEvent
s which will contain regular MIDI data (ie, for all 16 channels if the user so chooses). This is the easy part -- it's getting the outputs set up that's the trick.
精彩评论