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

Creating a VST wrapper

Aug 3, 2009 at 7:08 PM

Hi all,

I'm working with Reaper, and I'm seeing a situation that I think VST.NET might help solve.

Basically, Reaper allows you to build FX chains by inserting various VST instruments/plugins on a single track. Normally, each VST will forward the MIDI messages to its output, and this is what allows the chainning.

Unfortunately, some VST instruments don't forward the MIDI messages, and "eat" them up, making it impossible to use them in a chain.

What I'm thinking of doing is to "wrap" those VSTs within some kind of hybrid host/plugin. In other words, to Reaper it would appear as a VST, but to the offending VST, it would appear as a host. From there the wrapper would pass all MIDI messages to the VST and would forward them to its own MIDI output.

It's a bit like what this product does:

http://www.midevice.com/Products.aspx?ProductID=0

though in their case, they are mostly concerned with control messages than with note/velocity messages.

Would VST.NET allow me to build such a thing, or should I go "native" VST SDK ?

If possible with VST.NET, what do I need to implement/override to get at least the basic functionality of being a host/plugin hybrid ?

Thank you

 

Aug 4, 2009 at 6:15 AM

Yes you could, but I would not recommend it.

But I would recommend using VST.NET to prototype your solution quickly and do the final version in C++. The problem with VST.NET and going from the unmanaged to the managed world and visa versa is that it incurs a bit of overhead. When you build a plugin that hosts another plugin you have two interop layers in the chain and that can cause a problem. On the other hand, you can just try it and leave it, if the latency is acceptable.

I would go for a core-level plugin, that is a managed plugin that does not use the VST.NET framework but implements the IVstPluginCommandStub interface (Core) directly. To load the plugin that is to be wrapped use the VstPluginContext (Interop.Plugin). This class will give you access to all the (unmanaged) plugin methods. Now all you have to do is forward calls from the IVstPluginCommandStub to the VstPluginContext and visa versa. I wrote 2 such adapters for use in VstPluginContext (Core.Host) perhaps you find those instructional.

When programming the C++ solution do not use the classes from the VST SDK. Instead, implement the callback methods yourself and handle those by call on to the Plugin and doing your Midi thing (pass thru). I know there is an open source VST Plugin (just can't remember its name or who wrote it) that performs this technique (but now for oversampling). You could also take a look at the Interop code to see how VST.NET intercepts the calls and forwards them to a (managed) plugin interface.

Hope it helps.