I have a 3rd party VST plugin with 2 ins and 8 outs that I'd like to use with an AudioProcessorPlayer. When setting the plugin as the player's processor, we have
void AudioProcessorPlayer::setProcessor (AudioProcessor* const processorToPlay)
{
if (processor != processorToPlay)
{
if (processorToPlay != nullptr && sampleRate > 0 && blockSize > 0)
{
processorToPlay->setPlayConfigDetails (numInputChans, numOutputChans, sampleRate, blockSize);
processorToPlay->prepareToPlay (sampleRate, blockSize);
}
...
}
...
}
where numInputChans/numOutputChans are taken from the audio device, so typically 2 for both of them. However, it seems from
void AudioProcessor::setPlayConfigDetails (const int newNumIns,
const int newNumOuts,
const double newSampleRate,
const int newBlockSize) noexcept
{
sampleRate = newSampleRate;
blockSize = newBlockSize;
if (numInputChannels != newNumIns || numOutputChannels != newNumOuts)
{
numInputChannels = newNumIns;
numOutputChannels = newNumOuts;
numChannelsChanged();
}
}
that the info about the number of input/output channels never makes it to the plugin since numChannelsChanged() is a virtual function that is not implemented in VSTPluginFormat. So what happens is that the plugins happily tries to fill all of its 8 output channels ---> crash.
I'd suggest to either implement numChannelsChanged in the plugin format or, in AudioProcessorPlayer, not to use a buffer with the audio device's channel configuration but with the processor's default channel configuration (i.e. dummy channels if needed).
