This project has moved. For the latest updates, please go here.

Plugin wrap-around

Topics: Plugin Development
Nov 11, 2012 at 2:02 AM


How to write a plugin to wrap-around another plugins?

Nov 11, 2012 at 8:40 AM

Take a look at the WrapperPlugin sample (Source Code tab).

The Sample has two classes: One to pass calls from the host to the wrapped plugin and on to pass calls from the wrapped plugin to the host.

Here is a reference to one of the source files of that project.

The path to the wrapped plugin dll is configured in a config file and used to host that plugin within the managed plugin. The wrapped plugin can either be managed or unmanaged. See also the GetPluginInfo method in the file referenced above.

Hope it helps.

Nov 12, 2012 at 6:14 AM

Thank you for reply!

I will create empty project or template project.

Please tell me many step.

Nov 12, 2012 at 7:10 AM

I would suggest you start with a copy of the WrapperPlugin sample.

I'd be interested to know why you want to wrap a plugin? What added functionality are you planning to build?

Also check out the documentation .chm (downloads) - that has a lot of information on the inner working on VST.NET.

In short VST.NET marshals all VST calls from C++ to .NET (and back) - they end up in an object (class) called the Plugin Command Stub. That is the core level. The Framework one can use to build plugins is layered on top of that. So understand that the WrapperPlugin sample does NOT use the Framework. As you can see in the source it implements a PluginCommandStub object - that receives the calls the Host makes to the plugin. It also implements a Host Command Stub - a similar object that receives the calls the Plugin makes to the host. 

Any functionality you wish to add, you would implement in these two Command Stub Adapter classes. Those are the points of interception.

Let me know if this works for you.

Nov 12, 2012 at 7:43 AM
Edited Nov 12, 2012 at 3:36 PM

Hi Obiwan,

I want to wrap many free plugin into one plugin.

 IVstHostCommandStub _hostCmdStub;

        public HostCommandStubAdapter(IVstHostCommandStub hostCmdStub)
            _hostCmdStub = hostCmdStub;

How do i create  IVstHostCommandStub object to apply this constructor?

Many plugin are loaded to Plugin command stub, how to manage?

Nov 13, 2012 at 3:02 AM

Hi Obiwan,


How to host get free plugins are wraped-around on my plugin?

Nov 13, 2012 at 5:38 AM

Hmm. You understand that only one plugin can be active at a time. Will be tricky to be able to switch plugins during the time your wrapper-plugin is open. You'd have to determine the differences in Audio IO and report that back to host. Not all Hosts allow dynamic IO changes like that - VST.NET supports it though.

Each plugin would be represented with a VstPluginContext object and each plugin would need a reference to a Host Command Stub. You have to decide if that is one class (a separate instance for each plugin) or that you need a specific class for a specific type of plugin? Depends on what functionality you wish to add.

Just start with wrapping two plugins to see what kind of problems you will encounter.

PS: I dont understand the last question. Could you rephrase that?

Nov 13, 2012 at 6:49 AM

My plugin wrap a free plugin, how do I free plugin that can communicate with the host (ex: reaper) through my plugin?

My plugin should inherit from class?
My Plugin command stud too

Nov 13, 2012 at 2:29 PM

The HostCommandStub you pass to the VstPluginContext.Create is used by the (hosted) plugin to communicate back to the host. But realize that your plugin is playing host to that inner-plugin. So you have to pass on any method calls that come in on the HostCommandStub to the IHostCommandStub instance you received when VST.NET calls the GetPluginInfo method. 

You could derive from the Adapter classes that are in the WrapperPlugin sample and only override those methods that need special handling - make them virtual in the Adapter classes first.