Hi, Loading a VSTPlugin is an asynchronous process?
How to wait until the plugin is loaded to perform its configuration (e.g. load a preset) ?
In my example, loading a preset returns an error no plugin! in executed at once, but works fine if executed line by line.
(
~bassvst = VSTPluginController(Synth(\bassvst));
// open a plugin by name/key (might require VSTPlugin.search!)
~bassvst.open("sforzando.vst3", editor: true, verbose: false);
try {
~bassvst.loadPreset("MeatBallPizz");
} { |err| format("While loading the preset: %",err.errorString).warn;
~usevst=false;
};
};
)
The .open command has an action argument which you can supply with a function that will be called when it’s ready. You can put the preset loading stuff in there and it will happen nicely and when it’s ready
Indeed. Thanks.
To be noted that the doc leads to confusion: " action: an action to be called with this and a Boolean (success/fail)."
In this “action” function, one must not refer to the controller by this but by the variable holding it ( ~bassvst in my case).
To be noted that the doc leads to confusion: " action: an action to be called with this and a Boolean (success/fail)."
Yeah, the wording is a bit misleading. What I meant was that the function will be called with the VSTPluginController instance and a Boolean as arguments. This means that you don’t need a variable to refer to the instance: