[quote=“jimw”]I ran into this problem too. I’m using 1.46, so dunno if this applies to you, but here’s what I had to do to get things working with VST plugins on mono tracks:
- In VSTPluginInstance::prepareToPlay(), it calls:
That’s broken because numInputs/numOutputs is the max number of inputs/outputs that the plugin supports. I changed it as follows:
// This is broken - it always sets numInputChannels/numOutputChannels
// to the MAX values accepted by the effect, not what is actually
// currently connected. Here we assume that the host will have called
// setPlayConfigDetails() already with the correct I/O config.
//setPlayConfigDetails (effect->numInputs, effect->numOutputs,
// sampleRate_, samplesPerBlockExpected);
setPlayConfigDetails (getNumInputChannels(), getNumOutputChannels(),
Forgot to mention a couple related changes in the same file (juce_VSTPluginFormat.cpp). Again, this is from the 1.46 tree so not sure if this applies in more recent builds.
- VSTPluginInstance::processBlock() needs to be changed to check the actual number of channels before calling getSampleData() on the buffer. This fixes the actual assertion reported in the OP.
[code]// This is broken - this needs to work on the actual I/O config, not
// the max I/O config supported by the plugin. For example you could
// be passing in a mono buffer to a plugin that supports stereo, but
// is configured in mono. The old way could cause the getSampleData()
// call to access invalid memory.
//const int maxChans = jmax ((int) effect->numInputs, (int) effect->numOutputs);
const int maxChans = jmax (getNumInputChannels(), getNumOutputChannels());
for (i = 0; i < maxChans; ++i)
channels[i] = buffer.getSampleData (i);
- VSTPluginInstance::handleCallback() needs to handle the audioMasterPinConnected callback, so that the plugin can query the host to see what the actual I/O config is.
// Our plugins call this from resume() to see how many inputs/outputs are actually being used by the host.
// We assume that the host has called AudioProcessor::setPlayConfigDetails() prior to resume() with the
// correct I/O config.
// From AEffect.h:
// [return value]: 0=true, 1=false [index]: pin index [value]: 0=input, 1=output
// @see AudioEffect::isInputConnected @see AudioEffect::isOutputConnected
if (value == 0)
// Check inputs
if (index < getNumInputChannels())
// Check outputs
if (index < getNumOutputChannels())
// If we got here, the pin isn't connected