Creating a VST Wrapper

I’m exploring an idea I’ve had where instead of loading my plugin directly I could load a “wrapper” plugin which in turn would load my plugin inside - the benefit is that I could do a seamless auto-update for users without requiring restart of daw or anything by killing off instance A and then loading instance B. I’m guessing this could be a way of catching unhandled exceptions as well since it would just affect the child instance.

I have pretty much everything working, except that I’m a bit stuck trying to figure out how to “replace” the editor of the wrapper (which is an instance A editor) with the instance B editor . As far as I can tell from a plugin perspective I’m not allowed to do this, only the host can do it.

The other thought I had is taking all the logic of the code and compiling it as a DLL which gets loaded dynamically, and then this could get swapped on the fly from the plugin without affecting the plugin’s active editor since it wouldn’t need to be recreated.

Anyone ever try anything like this?

We used to do that at UVI on OSX when there was the Mach-O vs codewarrior based RTAS CFM back in the days.

I honestly wouldn’t recommend this given the very small gain vs possible headache.

I’ve created a PluginWrapper that allows the loaded plugin to be swapped, based on the ideas here:

Note that those code examples are somewhat old and had to be modified.

But the basic thing I added, after getting the wrapper working, was how to swap out the loaded plugin:

void PluginWrapper ::replacePlugin(std::unique_ptr<AudioPluginInstance> newPlugin)
    suspendProcessing (true);

    // replace the std:unique_ptr
    plugin = std::move (newPlugin);
    prepareToPlay(sampleRate, bufferSize);

    suspendProcessing (false);

From the place where you have created the new plugin, you have a std::unique_ptr, I call it like this:

plugWrapper->replacePlugin(std::move (instance));

It seems to work…