catching MidiEvents

Oct 8, 2008 at 11:30 PM
Hello,$0Sorry for my bad english and c# skills. But I am realy interested in this project, because it makes one of my coding ideas possible. I tried to get the samples running, but it didnt realy work. Anyway, one of my own simple vst.net application is running now. It is very simple... it does nothing except for creating a windows form. And the VST-Host accepted the plugin without any errors. The only thing I need is to display midiEvents triggered by the host-program. Could you help me with a simplyfied code example? Thank you. :)$0
Coordinator
Oct 9, 2008 at 8:16 PM
In order to receive Midi Events from the host, you implement the IVstMidiProcessor interface in your plugin. It is important to expose a reference to this implementation through the IExtensible methods on the IVstPlugin interface.

If you use the PluginInterfaceManagerBase class as a base for your Interface Manager implementation, just override the CreateMidiProcessor method and return the reference there. If not ignore what I just said ;-).

Now, when the Host calls the Plugin with MidiEvents, your implementation of the Process method (on IVstMidiProcessor) will be called. The MidiEvents passed into the method are for the current time-slice and its delta time is always relative to the current time-slice.

Check out the Jacobi.Vst.Samples.MidiNoteMapper and MidiNoteSampler samples, for they too receive midi input from the host. Also check out the VST Resources page (link is on the home page). There you'll find references to 4 blog posts I've written about VST.NET.
Oct 11, 2008 at 7:33 PM
Edited Oct 11, 2008 at 7:36 PM
Thank you for the Help. But I still do not recive the Events.I return my MidiProcessor on the CreateMidiProcessor method of the Plugin and I've put a messageBox-call into the Process method of the MidiProcessor. But it does not pop up if the host (ableton live 7.0) sends midi signales. Problem 1: I do not understand how to expose a reference through the IExtensible methods like you said. Problem 2: I finaly got your samples running but I also dont get events with this code. I have to chance the assembly links (to core and framework dll). I instaled them as described by drag-and-drop them into the Windos/assembly folder. I also instaled them with the commandline tool gacutil. And it looks like they are instaled. But VisualStudio Express does not find the assemblys in the global assembly cache. Currently I link the core and framework dll's from a seperate folder to get the sample running. Hopefully you find some time to reply :)
Coordinator
Oct 12, 2008 at 2:41 PM
1) How did you implement your Plugin Root Object, that is created in the CreatePluginInstance override on the StdPluginCommandStub and implements IVstPlugin. Did you use one of the base classes the framework provides? If you used VstPluginWithInterfaceManagerBase you did everything right. IExtensible is then implemented by the PluginInterfaceManager base class. If not, you have to route the methods of IExtensible to the inetrface manager instance you use (where you implemented the CreateMidiProcessor override). If you have that, you should be ok.

2) If the samples also doesn't work on Ableton Live 7.0, it perhaps indicates some issues. I have not tested on ableton (I might do that). The CorePlugin sample or the Steinberg VstMonitor plugin are great to see what the host is doing to/with your plugin... As for the dependencies: the Core and Framework can either go in the GAC (either drag and drop them in the Windows\assembly folder using the windows explorer -or- use gacutil.exe.) You should see them when you refresh the windows explorer view of the windows\assembly folder. You can also install them (core and framework) next to your plugin assemblies (one renamed interop and your renamed dll).
Oct 12, 2008 at 10:07 PM
3 out of the 4 samples worked (I think it was the Core sample that didn't work, but can't check presently) when using VST.NET release 0.3 on Ableton Live 7.0.3.

Cheers
Jan 16, 2010 at 2:48 AM

I'm sorry for adding this late reply, but didn't want to start a new topic for this.

How dit you get the samples working in Ableton Live? what setup dit you use?
For the midimapper example I'm using a midi track where i use the midimapper as an instrument. (Live recognises it as a Midi Instrument, not a Midi Effect)
then i set the midi-out to the midi in of another midi track with a standard live-midi instrument.
then i arm the midi-mapper track And then when i play midi notes (on my pc keyboard) i should hear the instrument sound. But nothing happens.

I dont know it it is any help, but i also tried the Core sample in Ableton Live, twice.
The first time it only showed: "SetEditorKnobMode: Linear". The second time i got more. But after adding an instrument to the track, again only "SetEditorKnobMode: Linear" was left.

The plugins work fine in the VSTHost tool.
Also, the MidiNoteSampler plugin works fine in Ableton Live.

Am I doing something wrong?
Is there some setting that makes Ableton Live recognise the plugin as a midi plugin that i just can put infront of my instrument on the same track, like an arp?

I'm using Live 8.0.5 to test.

Hope you and/or willshak find some time to reply.
Thanks in advance!

Coordinator
Jan 16, 2010 at 6:52 AM

I think the problem is that live doesn't see the MidiNoteMapper as a Midi effect (Midi In/Out) plugin. The Audio part in the MidiNoteMapper is a dummy implementation used only for syncing up the Midi output. You could try and play with the number of audio channels (constructor of the AudioProcessor class)..?

I currently don't have the time to investigate this with Live for myself. Sorry.

Jan 18, 2010 at 12:54 AM

No problem, i think your tips will get me on the right track eventually!

I tried adding

this.OutputCount = 0; 
this.InputCount = 0;

to the constructor of the AudioProcessor class, and i saw a new option come up in live when selecting the channels, so this seems promising at least...

But maybe i shouldn't be focusing on midi out, but midi in: I added a logging textbox that shows a log-string each time a midi event comes in ( in the process function in MidiProcessor ). All events show up fine in the VSTHost tool, but in Live i saw no events come in at all. Maybe it has something to do with me using the pc keyboard or a midi clip in live as input, perhaps using a real midi controller will work, but i doubt it... will try this out later.

I also found some pointers on http://www.kvraudio.com/forum/viewtopic.php?p=3933444

I'll look into them later and will report any findings here.

Coordinator
Jan 18, 2010 at 6:49 AM

Not receiving any midi on your plugin. Could it be a (midi) routing problem in Live?

Jan 21, 2010 at 11:21 PM

Ok, after searching around i found the solution on http://www.kvraudio.com/forum/viewtopic.php?p=3827742

It seems that Live only will start sending midi messages if the outputcount is 1.

so after setting

this.OutputCount = 1;
this.InputCount = 0;

and setting up live in the right way,  it all just worked.

for future reference for people running into this problem, here's how you set up Live:

  • Create a Midi Track and drop the MidiNoteMapper onto it.
  • Create a Midi Track with the instrument you want to use.
  • Now set up the instrument Midi track like this:
    • Midi From: <Track Name> (Midi Track with the MidiNoteMapper)
    •                  <Device Name> (Jacobi.Vst.Samples.MidiNoteMapper)
    • Monitor : IN
  • Now arm the Midi Track with the MidiNoteMapper and you're all set!

Thanks for your help ObiWan!