diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc index 1262b7e250..50757f9acd 100644 --- a/libs/ardour/ladspa_plugin.cc +++ b/libs/ardour/ladspa_plugin.cc @@ -609,14 +609,14 @@ LadspaPlugin::connect_and_run (vector& bufs, uint32_t nbufs, int32_t& i while (port_index < parameter_count()) { if (LADSPA_IS_PORT_AUDIO (port_descriptor(port_index))) { if (LADSPA_IS_PORT_INPUT (port_descriptor(port_index))) { - connect_port (port_index, bufs[min((uint32_t) in_index,nbufs)] + offset); + connect_port (port_index, bufs[min((uint32_t) in_index,nbufs - 1)] + offset); //cerr << this << ' ' << name() << " @ " << offset << " inport " << in_index << " = buf " // << min((uint32_t)in_index,nbufs) << " = " << &bufs[min((uint32_t)in_index,nbufs)][offset] << endl; in_index++; } else if (LADSPA_IS_PORT_OUTPUT (port_descriptor (port_index))) { - connect_port (port_index, bufs[min((uint32_t) out_index,nbufs)] + offset); + connect_port (port_index, bufs[min((uint32_t) out_index,nbufs - 1)] + offset); // cerr << this << ' ' << name() << " @ " << offset << " outport " << out_index << " = buf " // << min((uint32_t)out_index,nbufs) << " = " << &bufs[min((uint32_t)out_index,nbufs)][offset] << endl; out_index++; diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index 70037fa5c2..2f3653a16a 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -391,12 +391,12 @@ VSTPlugin::connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in_ int32_t i; for (i = 0; i < (int32_t) _plugin->numInputs; ++i) { - ins[i] = bufs[min((uint32_t) in_index,maxbuf)] + offset; + ins[i] = bufs[min((uint32_t) in_index,maxbuf - 1)] + offset; in_index++; } for (i = 0; i < (int32_t) _plugin->numOutputs; ++i) { - outs[i] = bufs[min((uint32_t) out_index,maxbuf)] + offset; + outs[i] = bufs[min((uint32_t) out_index,maxbuf - 1)] + offset; /* unbelievably, several VST plugins still rely on Cubase behaviour and do not silence the buffer in processReplacing