Tale
04-26-2010, 04:50 AM
I believe I have found a bug in IPlug: When I load my ComboV plug-in into VSTHost, the host says the plug-in has 1 input and 2 outputs, while in fact it has 0 inputs (PLUG_CHANNEL_IO == "0-2"). Other VSTi plug-ins do report 0 inputs in VSTHost, so I figured something must be wrong in the way ComboV or IPlug reports its inputs to the host. After some digging I found the following lines in IPlugVST.cpp:
memset(&mInputSpkrArr, 0, sizeof(VstSpeakerArrangement));
memset(&mOutputSpkrArr, 0, sizeof(VstSpeakerArrangement));
mInputSpkrArr.numChannels = nInputs;
mOutputSpkrArr.numChannels = nOutputs;
What is missing here is the definition of the speaker arrangement type. Because memset() fills the struct with zeros the type always is 0, which is the value for kSpeakerArrMono and not kSpeakerArrEmpty as one might expect.
I think defining the type as follows would fix this bug:
mInputSpkrArr.type = nInputs == 0 ? kSpeakerArrEmpty : kSpeakerArrUserDefined;
Or perhaps even:
mInputSpkrArr.type = nInputs == 0 ? kSpeakerArrEmpty : nInputs == 1 ? kSpeakerArrMono : nInputs == 2 ? kSpeakerArrStereo : kSpeakerArrUserDefined;
The same fix should be applied to the output speaker arrangement.
memset(&mInputSpkrArr, 0, sizeof(VstSpeakerArrangement));
memset(&mOutputSpkrArr, 0, sizeof(VstSpeakerArrangement));
mInputSpkrArr.numChannels = nInputs;
mOutputSpkrArr.numChannels = nOutputs;
What is missing here is the definition of the speaker arrangement type. Because memset() fills the struct with zeros the type always is 0, which is the value for kSpeakerArrMono and not kSpeakerArrEmpty as one might expect.
I think defining the type as follows would fix this bug:
mInputSpkrArr.type = nInputs == 0 ? kSpeakerArrEmpty : kSpeakerArrUserDefined;
Or perhaps even:
mInputSpkrArr.type = nInputs == 0 ? kSpeakerArrEmpty : nInputs == 1 ? kSpeakerArrMono : nInputs == 2 ? kSpeakerArrStereo : kSpeakerArrUserDefined;
The same fix should be applied to the output speaker arrangement.