[SOLVED] Ableton Live 8.0.4 not processing MIDI events

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Hi folks,

I've discovered a rather large problem with my DC'09 entry...

My plugin sends MIDI messages to the host based on input from a Direct Input device, and thus far works fine on the hosts I have access to. However, last night I got my hands on a copy of the Ableton Live demo, and discovered that the main loop of the plugin isn't being executed.

Now, I've tracked that particular problem down (I was triggering my polling of the device with a call from processEvents(), which isn't called automatically in Ableton, near as I can tell- I'm still looking into it), and I've managed to get it polling the device again by moving the polling trigger to the idle() event of my editor (with a view to refining the timing once sound is being produced again).

However, now that I've done this, the MIDI events being sent via sendVstEventsToHost() no longer seem to be being processed. I've run it through the debugger, and the same MIDI messages that were being sent before are still being sent now. Energy XT, which was working fine prior to me shifting the trigger, isn't working this way either.

So, does anyone have any idea what could be causing this? I have a theory that it could be something to do with timing (calling pollForEvents() from processEvents() had the advantage of being synched with the host's clock by default), but I'm wide open to other suggestions...

Thanks in advance :)

Update: Right... Once it's polling regaularly from processReplacing(), and numInputs set to 1, it actually works fine- I just had to learn how to use the software properly ^-^

Thaks Everyone! =D
Last edited by Minouris on Sat Oct 31, 2009 9:41 pm, edited 2 times in total.

Post

Hmm...processEvents() and the GUI idle() normally are in separate threads, aren't they? Could sendVstEventsToHost() be sensitive to which thread it's in?

Post

It's more than possible... I'm a bit new to C++ and VST both, unfortunately (although amply experienced as a software developer overall), so my experience and knowledge here are both a bit limited.

I had originally though to use the equivalent method in the AudioEffect class (onIdle()? I don't have access to the SDK on this machine to make sure...), but that method is deprecated, so I'm a little reluctant to make use of it, lest I run into the same problem, different method further down the track :P

I've seen hints in other threads that suggest that the timing of MIDI messages is very important.

I've seen others that suggest that MIDI event sending can/should be triggered by using a hook in processReplacing(), but is that guaranteed to be called at the correct rate by the host, regardless of whether there is audio to process? Is it only called when the the plugin has the canProcessReplacing canDo? All stuff to take into consideration...

I think, once this is working, I shall write a nice, fat tutorial on VST MIDI, so that the next poor bugger doesn't have these problems- seems like it's a bit of a blindspot in the existing documentation so far ^-^

Post

deraudrl wrote:Could sendVstEventsToHost() be sensitive to which thread it's in?
That's a grey area in the VST 2 specification - in versions before V2.4, it wasn't specified whether there are any restrictions. Since V2.4, the documentation says "can be called inside processReplacing()". Now, you can argue whether "can be" is synonymous to "can't be called anywhere except"... some hosts react very sensitive if events are sent from anything but process(Replacing)().
"Until you spread your wings, you'll have no idea how far you can walk." Image

Post

Thanks heaps guys :)

I've moved my call to pollForEvents() (which calls sendVstEventsToHost()) into processReplacing() rather than processEvents(), and it's at least working again in EnergyXT :)

Still no joy in Ableton though- is there something special I need to do to get Ableton to call processReplacing()? I've got no activity showing at all when I use the game controller (although I can select it, so Direct Input is at least able to see it), so unless Ableton makes use of (and reserves / locks) the controller then it still isn't polling...

I'd be tempted to wonder if Ableton is calling process() instead of processReplacing(), except I read in another thread today that Ableton doesn't play nice with VST 2.3 or lower...

Post

Minouris wrote:[..] Still no joy in Ableton though- is there something special I need to do to get Ableton to call processReplacing()? [..]
Do you expose all the right flags? effFlagsCanReplacing?
Grtx, Marc Jacobi.
VST.NET | MIDI.NET

Post

I'm calling canProcessReplacing(true) from my constructor, which seems to set it.

This is what I've got to broadcast plugin capabilities:

In the constructor:

Code: Select all

setNumInputs(0);
setNumOutputs(0);
canProcessReplacing(true);
isSynth();
Virtuals:

Code: Select all

VstInt32 VstPlasticGuitar::canDo(char *cando) {
  if (strcmp(cando, "sendVstMidiEvent")
	|| strcmp(cando, "receiveVstMidiEvent")) {
    return 1;
  } else {
    return -1;
  }
}

VstPlugCategory VstPlasticGuitar::getPlugCategory () {
  return kPlugCategSynth;
}

VstInt32 VstPlasticGuitar::getNumMidiInputChannels() {
  return 16;
}

VstInt32 VstPlasticGuitar::getNumMidiOutputChannels() {
  return 16;
}

Post

I'm not positive on your problem, however be aware that Ableton Live will suspend the plugin after about 2 seconds if:

- there is no Audio in or out
and
- there is no MIDI in or out
and
- the GUI is closed.

You might want to set your outputs to 2 and generate some noise to verify this isn't the problem.

I had to create a (very) quiet noise to prevent this suspending on plugins that are OpenSoundControl based (perhaps there's a better way to prevent Live from suspending, but I couldn't find it)
Image

Post

Thanks, that's definitely worth knowing- is the suspension done via the suspend() method? If so, then it can probably be overridden... If it just suspends the thread then that's more of a problem ^-^

I'm wondering now if it has something to do with my numInputs() / numOutputs() calls... I'd assumed that they applied solely to audio samples, but perhaps Ableton is assuming it doesn't need to call processReplacing() if there isn't anything to process...? Or perhaps it counts MIDI events as an output channel? Alas, I'm on my work PC right now, and won't be able to test my theory until I get home...

Post

Alrighty! By calling numOutputs(1) instead of numOutputs(0) I got it to start polling, and sendVstEventsToHost() is being called with everything I was expecting (according to debugging).

However, I'm still not getting any sound out, and the track control panel in Ableton now shows an audio out option box instead of a MIDI out option box. I can select my plugin as an input to the synth in the next slot over, but it doesn't seem to make much difference...

Post

Okay, here's the current status:

1. The plugin is able to load in Ableton
2. The game controller is polled, and button presses show up in the GUI the way they should
3. Acording to the debugger, sentVstEventsToHost() is being called, and is being invoked with all the MIDI events it should be.

But no MIDI signals are being received by the next plugin in the chain.

So, is this most likely a problem with the way Ableton is processing my MIDI, a problem with the way I've got the app set up (or the plugin), or is there still somethng I ned to do in th4e plugin to make its MIDI output more palatable to the host?

Please?

UPDATE: Nope, turns out they're being received just fine- I just wasn't using it right.

Thanks everyone! :)

Post Reply

Return to “DSP and Plugin Development”