Weird Behavior in Ableton Live - Infinite Feedback Loop?

First of all, I’d like to say a quick thanks for all the work that has been put into the iPlug2 framework. I am just starting out with VST dev and I am having a great time using the framework and getting up to speed.

For hosting and testing my VST I always use Reaper, but recently I installed Ableton Live to make sure my VST would also work there.

Ableton was giving me a bit of trouble but then I found a post (MidiEffects does not work on VST3?) explaining that Ableton doesn’t like VST3 plugins with empty input buses. Took care of that by adding some inputs to PLUG_CHANNEL_IO in my config.h, but now I am encountering more Ableton weirdness and I am wondering if anyone has encountered this or has any suggestions for me.

Details about my VST:

  • PLUG_TYPE is 1 (I intend this is as VST Instrument)
  • No audio input (but I have PLUG_CHANNEL_IO "1-1 2-2")
  • Takes MIDI in, no MIDI out
  • Produces audio based on MIDI messages

Description of the problem:
Run Ableton and set up my VST on a MIDI track. Trigger my VST with MIDI to make it sound. My VST’s intended behavior (and the behavior I see in Reaper) when it gets a MIDI Note On is to generate a short burst of audio. But what actually happens in Ableton Live is it generates the burst of audio and then kicks off what appears to be an infinite (feedback?) loop where the short burst of audio I generated is repeated ad infinitum. The track hosting my VST in Ableton Live never becomes silent.

I have confirmed with the debugger that my code isn’t adding these errant samples to the output buffer. I also built my VST as a VST2 to see if that made a difference, but it does not - Ableton Live has the same behavior for the VST2 build.

Does anyone have any ideas why this might be happening? I can provide more details about the VST or the actual code if it may be relevant.

I should note that this is not an issue in Reaper - in Reaper my VST behaves perfectly fine.

Stepped away for a couple days and now I see my problem:

My ProcessBlock code was ignoring all but the first output buffer. Whenever I wanted to write some audio into the buffer, I was writing my samples only to the first output buffer, i.e. outputs[0], and ignoring any other output buffers even when NOutChansConnected() was returning >1.

Using that strategy I am now also pre-zeroing all the output buffers:

  for (int c = 0; c < NOutChansConnected(); c++)
    memset(outputs[c], 0, nFrames * sizeof(sample));

And the problem is solved.