Feb 19, 2012 at 4:40 PM
Edited Feb 19, 2012 at 4:43 PM
Hi obiwan and robcheese!
I have some trouble with implementing MIDI generation to my VST effect.
I have studied MidiNoteSampler and MidiNoteMapper sample projects, and all I could find in VSTNET documentation. I have visited http://home.roadrunner.com/~jgglatt/ website to learn about MIDI
commands but still I can't make my effect to send MIDI commands to host.
As far as I figured out:
- I added IVstMidiProcessor CreateMidiProcessor(...) , IVstPluginMidiSource CreateMidiSource(...) and MidiProcessor MidiProcessor to my Plugin.cs file
- Added MidiProcessor.cs file from template MidiPlugin and figured out that I have to add events to VstEventCollection CurrentEvents;
- To my AudioProcessor's Process() function I added this:
- Implemented AddDummyEvent() like this:
This should turn on middle C at volume 100 every time the ProcessCurrentEvents() is called (so that mean's pretty often
public void AddDummyEvent()
byte b = new byte;
b = 0x80;
b = 60;
b = 100;
VstEvent evs = new VstEvent;
evs = new VstMidiEvent(0, 0, 0, b, 0, 0);
VstEventCollection ev = new VstEventCollection(evs);
CurrentEvents = ev;
What I don't understand is this comment before CreateMidiSource in Plugin.cs:
/// Implement this when you output midi events to the host.
I copied it from MidiPlugin template and as far as I see, I think it should work.
When I test my plugin (its in FL Studio 10) I have to assign an output MIDI port in my plugin and assign an input MIDI port to other VSTi synth. I'm doing it but it's not working.
I think I didn't understand something so I'm asking you for some help.
Also my implementation of AddDummyEvent() seems to be bad. It must be more easy way to add MIDI event to output events for host.
All what I want is to automaticly "press" and "release" MIDI notes.