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

Plugin instance reset for each plugin call

Dec 25, 2010 at 6:35 PM

Hi. My new plugin is almost done - everything works fine, but i've noticed some strange thing - each time I hide and show editor everything (knobs values) is resetted. It is certainly because plugin is somewhere created again (constructor is called). How to repair this? Thanks in advance for help.

Dec 25, 2010 at 7:14 PM
Edited Dec 25, 2010 at 7:15 PM

Good to hear everything works out for you.

In my view, the UI is just a view onto the plugin settings (programs, parameters etc). This means that each time the user starts your plugin Editor (UI), you read your plugin state (programs, parameters etc) and initialize the view/UI with those values. Changes to the UI controls are fed back to the internal plugin state (programs, paramaters etc) possible using value smoothing (to avoid clicks in the audio, for instance). So my advice would be to program your plugin using a similar mechanism.

It is my understanding that this is also the way the (native C++) VST interface was intended.

The WinFormsControlWrapper class was also designed with this mechanims in mind. You could change it and keep your UI alive (but hidden) once it is created, just dont call the Close method on the wrapper. Instead, detach the parent window handle from your UI control (call SetParent with null?) and hide the window.

Hope it helps.

Dec 25, 2010 at 7:24 PM

Ok. It helps :) Thx.