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

How to manage programs form the plugin

Topics: Plugin Persistence, Plugin Programs, VST.NET Framework
Dec 29, 2011 at 4:18 PM


I'm trying to set up loading, saving, selecting, and creating new programs from within my plugin but I'm having trouble getting any of the changes I make to be reflected in the host. For example when I add new programs to the list of programs in PluginPrograms, the host's list of programs does not change.

Is there a way to send a stream (similar to the stream I would created in WritePrograms() ) to the host or to the framework and tell them to fill in all the required info to save it as an .fxp or .fxb file?  Also can I change the active program from within my plugin and have these changes reflected in the host?


Dec 31, 2011 at 9:06 AM

The design of the VST API suggests that the number of programs is fixed for the lifetime of a plugin (instance). My guess is that this was designed this way to mimic the hardware devices that also had fixed number of programs (or patches). There is one thing you could try, but it involves some extra overrides in the VST.NET Framework and probably not all hosts will support the 'hack'.

  1. Override the StdPluginCommandStub.CreatePluginInfo and save the return value of the base class into a private field. The VstPluginInfo contains the number of programs (among other 'statics') your plugin supports. Return the same VstPluginInfo value from the method.
  2. In the IVstPlugin.Open(IVstHost) call query the host method parameter for VstHostCommandStub by calling host.GetInstance<VstHostCommandStub>(). Store the return value in a private field.
  3. When the number of programs change in your plugin, update the ProgramCount field in the VstPluginInfo instance and call the VstHostCommandStub.UpdatePluginInfo method passing it the reference to the PluginInfo instance you just changed.

To my knowledge there is no way to inform the host that the active program has changed, but perhaps you should ask this question on the kvraudio forum for there are a lot of plugin devs active there, that may have a good answer to your question.

Hope it helps,

Jan 2, 2012 at 6:42 PM

I'll give your idea about changing the number of programs a shot. And it's not a big deal if some hosts don't support this as long as I can change the active program from within my plugin. I asked about how to do this on KVR ( ) and they said that if you call updateDisplay() after changing the active program then the host will recognize the change. Is this call exposed anywhere in your framework?




Jan 2, 2012 at 6:56 PM
Edited Jan 2, 2012 at 6:57 PM

Ah yes of course, UpdateDisplay. Thanx for taking the time to sort that out.

You can find that call on the IVstHostShell interface. A reference to that interface can be obtained by calling host.GetInstance<IVstHostShell>() on the host parameter the plugin receives in the Open method (similar to item 2 in my previous answer).

Hope it helps,

Jan 2, 2012 at 8:32 PM

The call in IVstHostShell worked like a charm.

Thanks for the help!

Mar 13 at 5:24 AM
Thank goodness, I've been faffing around with this one for days - thanks chaps....