Plugin does not respond to MIDI messages

Topics: Midi, VST.NET Framework
Feb 18, 2012 at 12:33 PM
Edited Feb 18, 2012 at 12:33 PM

I'm trying to write a managed VST host. I have the plugin loaded and audio running. When I open plugins' provided GUI I can hear the sound when I click on notes on its virtual keyboard. However plugin does not respond to my MIDI messages (no sound output and the MIDI IN light on the plugin GUI also does not flash). Am I doing something wrong? Basically I just start plugin and processing:

plugin.MainsChanged(true);
plugin.StartProcess();

and then when there are incoming MIDI messages I just send VstMidiEvent with approprate MIDI data to the plugin

plugin.ProcessEvents(myVstMidiEvent);

Also is it normal that plugin repeatedly sends to host the following information:

Plugin 1316373042 called:GetTimeInfo(PpqPositionValid, TempoValid)

Coordinator
Feb 18, 2012 at 3:40 PM

Yes, a plugin typically will ask the host for time info during each ProcessReplacing call. It is expected that the Host will have this info readily available.

- Do you call the ProcessReplacing function repeatedly? Most plugin processing is usually done there. It is likely the place where the Midi is actually turned into audio.
- Make sure you call ProcessEvents first, before calling ProcessReplacing.
- Check the plugin flags and the CanDo's the plugin reports (you can write the code or use VstHost.exe which reports it nicely). Make sure you call the correct methods that are compatible with/supported by the plugin.
- Also check the (Get)VstVersion the plugin reports. If it reports a version lower than 2.4 (2400) you might also have to look into the deprecated methods (Core.Deprecated types) and call those (functions like Idle).
- You can use System.Diagnostics TraceSources to log all the calls made to and from the host.
- You might want to use the WrapperPlugin sample to wrap the actual plugin and allow you to set breakpoints for certain method calls.

Hope it helps,
Marc 

Feb 20, 2012 at 5:12 PM

Yes, I call ProcessReplacing function repeatedly. Right before I call ProcessEvents function. And still plugin does not receive MIDI data. Maybe it has something to do with the fact that I'm running host, plugin and audio (midi) engine each in its own threads?

Coordinator
Feb 20, 2012 at 5:46 PM

It is normal to have a separate audio/midi engine thread. That is also the thread that calls into the plugin on the ProcessEvents and ProcessReplacing methods.

Other parts of the Host - like the UI - call into the plugin using other threads. There is a function that the host should implement called GetProcessLevel, that allows the plugin to query what thread it is called on. See also http://vstnet.codeplex.com/SourceControl/changeset/view/63261#191470

I would suggest you use the wrapper plugin to log (trace) the calls the plugin (and host) make when you load the (wrapped) plugin into another host like vsthost.exe. That way you can see quickly if you forget to call something important or that the plugin calls something you dont implement yet.

Hope it helps.
Marc