This project has moved and is read-only. For the latest updates, please go here.

Midi out to Host

Topics: Midi, Plugin Development
Mar 15, 2014 at 4:02 PM
Hey Marc,

It's been a while, I'm still hacking away on my software bah....

Here is a Midi processing question for you. My plugin wants to send Midi to a Host but will probably never receive any - so I have set SyncWithAudioProcessor to true and and using the Audio Processor to do the work (Midiprocessor.Process isn't called often if at all).

How do I get the messages back to the host ; any ideas ? If I try and use the VstEventCollection passed into MidiProcessor (but outside of the process callback) I get a read-only exception which is fair enough.

Its a bit of a poser and I'm hoping that it's very straightforward; I'm too bogged down to think it out.

I hope you or your other fans can help ?

Kind regards

Mar 15, 2014 at 4:23 PM
Oh not too thick !

It's in the MidiNotePapper - get an interface to the HostProcessor and call Process.

Sorry and thanks.
Mar 15, 2014 at 4:56 PM
No problem. Glad I could help. :-P
Mar 16, 2014 at 3:48 AM
Well, I think I made those changes correctly :/

I am now returning null from Plugin.CreateAudioProcessor so that my host thinks it's dealing with a Midi only plugin - and I can then route output data to a Midi port after my code. This means that Process isn't called in the AudioProcessor as expected but neither is MidiProcessor.Process; I'm not sure that's a problem or not?

Anyway, I'm just making calls to hostProcessor.Process from my GUI which doesn't yield any returns to the host - nothing I can see anyway, I wish I had a Midi port monitor. It's too late to be thinking, I'll have another go tomorrow.

Mar 16, 2014 at 7:18 AM
If you mind making your binairies or sources available, I can run/debug it in my host and see what it does. When developpimg I link every libraries as project references to find issues easier. Sometimes I'm a little bit puzzled at how I should test these midi plugins because they're usually not very user friendly. I don't know about other hosts but I do call ProcessEvents regardless of plugin capabilities. Makes sense that a midi plugin should receive midi events, many are used to transform/scale midi events.
Mar 16, 2014 at 8:15 AM
Some hosts, like Cubase are really picky about what constitutes a midi-plugin. That is the reason for the dummy audio processor. I think your safest bet is to output midi during the Process cycle of the audio processor.

@Yury: You can use the Send- and Receive(Midi)Events cando's to tell if a plugin want's midi input.
Mar 16, 2014 at 12:25 PM
Thanks guys,

yep I have one of those picky ones - Ableton. To get it to recognise my plugin as Midi only I can't implement IVstPluginAudioProcessor - but If I do that AudioProcessor.Process never gets called. If I do implement it then it's an Audio Plugin and the host doesn't except Midi to be returned (which Is what I want because I then need the Midi to go to a hardware device). Its a nasty catch22 of Steinbergs pipeline.

No worries, for the moment I'll go back to my original design and have my plugin talk directly to the required port - and whatever Synth / Sampler is connected. That means that the host can't have that device but all midi could be funnelled to My host track so all messages can be sent indirectly.

YuryK, like you I like to split off all reusable code into separate libraries - so I can share stuff between my projects. Unfortunately with this one I've had so many domain issues between hosts especially with the WPF elements that I've built everything into one. I Hated having to do this but WPF is very touchy about paths and permissions and while I had no problems with Reaper and Ableton, Cubase especially couldn't find certain resources. In the end I relented grrrr.

Also, I've already debugged inside Marc's host and my midi process calls are making into the framework.Host.VstHostMidiProcessor,Process and upward so it looks ok, I can only presume that the host (as Marc says) doesn't like arbitrary calls - they have to be within its own Process cycle.

Well, thanks again for your attention; I have my fallback so I'll fiddle with that when the fog clears.

Kind regards