So what happens if the open fails in the above example with the CondVar?
Does cv,wait then block forever?
I was afraid you would ask this Yes, in this case it would block forever. (Note that you would still get an error message in the console, so you at least know that something has been going wrong.)
Here’s the version with error handling:
fork {
var cv = CondVar(), done = false;
~fx = VSTPluginController(~synth).open("foo", action: { done = true; cv.signalOne });
cv.wait { done }; // note the boolean test!
if (~fx.isOpen) {
// now you can use the plugin
~fx.editor;
~fx.loadPreset("baz");
} {
// error handling
}
}