Preserving States in VST Plugins

While debugging my plugin using the Audio Plugin Host, I have noticed that when you close the PluginEditor window, the object is destroyed. As well, when opening a plugin the PluginEditor object is created, then immediately destroyed, and then created again. Why the create/delete/create?

I would like to preserve the state of a plugin across open/close. I also want to be able to open multiple instances of the same plugin and have them properly remember their internal states. I have the serialization working fine, but I am not sure exactly how to “remember” which state belongs to which instance, because they are destroyed and recreated each time.

Any suggestions would be great, thanks!

If your code can’t cope with your editor objects being deleted and created (or with multiple editors on the same plugin), then you need to fix your design! The processor object is the place to store your state, not in the editor.

Aha, that’s exactly what I was looking for.

Thanks Jules!