some VST-Hosts don't implement a Midi-Clock Signal (mostly light/personal/etc.-versions). My goal is to implement a midisync-vst, wich will (in the fisrt stage) act as midi-master-clock syncing vstTimeInfo to all connected MidiDevices. (later versions should
make the devices selectable and/or allowing to sync the vst-host to an external midi-clock signal). ControlFunctions (Start, Stop, Rewind etc.) would also be nice. Weapon of choice is C#.
This is my first appraoch at programming vst-plugins and implementing midi and before I start reinventing the wheel or implementing redundant things from the .Net MidiToolkit (http://www.codeproject.com/KB/audio-video/MIDIToolkit.aspx), I'd be grateful about
some advice, so there will be some questions, first of all:
- Can this be done with VST.Net?
Looking at the class-diagramms I found IVSTHostCommands20.GetTimeInfo wich probably gets me time an position information, but I could not find anything related to Midi-tempo or Midi-songposition.
- Where / when to use GetTimeInfo (MidiProcessor.Process()?, AudioProcessor.Process()?, poll at intervalls? not at all?)
- How to send generated MidiClock Information?
Jul 15, 2008 at 6:31 AM
Edited Jul 15, 2008 at 12:12 PM
I think it can be done (in VST or VST.NET - should be no different). Unless you want to write your Plugin at Core level (the basic marshaling level), you wont see the IVstHostCommandsXx interfaces. When you write your Plugin using the Framework, you'll
receive a reference to the IVstHost interface when Open is called on your Plugin root class. Call GetInstance<IVstHostSequencer>() on the IVstHost reference to obtain the host interface that deals with sequencing (and time) information. Here you'll find
GetTimeInfo which returns a VstTimeInfo instance.
The VstTimeInfo class has several flavors of time information available. The question is what the host supports and will fill in. So, in order for your Plugin to work in multiple hosts, you'd need to have several conversion algorithms in place. Note that when
asking for time info, you specify some flags to request a specific format but you will not always receive the time info in that requested format (depending on what the Host supports).
I'm not sure what would be the best place to poll for the time info. I think you might have to implement a dummy AudioProcessor and poll for it in each Process call. But you can try it first by simply doing the processing behind IVstMidiProcessor.Process. Isolate
the processing in your code and experment calling it from different places.
To send Midi events to the Host, you call GetInstance<IVstMidiProcessor> (yes, thats right, the same interface you implement as a plugin when receiving midi events) on the IVstHost reference. Call the process method and pass it a collection of VstEvents
(either VstMidiEvent or VstMidiSysExEvent instances).
Take a look at the MidiNoteMapper sample added recently in the source code. It has some of the features that you need (a dummy AudioProcessor and Midi out).
Hope it helps,