summaryrefslogtreecommitdiff
path: root/libs/ardour/linux_vst_support.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-03-06 23:49:40 +0100
committerRobin Gareus <robin@gareus.org>2017-03-07 00:13:56 +0100
commite1095310a8186bbd977534285df0ab29423d3aa3 (patch)
treeeae28a2a01773762ae77bf7b12c1270df7d468cb /libs/ardour/linux_vst_support.cc
parent589c13c0eb9f6003a7e8cf923110459c897ea4b0 (diff)
Rework VST initialization:
Set the AEffect* plugin pointer before calling effOpen. effOpen may call back into the host (masterCallback) and invoke actions which depend on _plugin (eg. to call back into the plugin again)
Diffstat (limited to 'libs/ardour/linux_vst_support.cc')
-rw-r--r--libs/ardour/linux_vst_support.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/libs/ardour/linux_vst_support.cc b/libs/ardour/linux_vst_support.cc
index be16340f2a..44d61f7a77 100644
--- a/libs/ardour/linux_vst_support.cc
+++ b/libs/ardour/linux_vst_support.cc
@@ -306,14 +306,16 @@ vstfx_instantiate (VSTHandle* fhandle, audioMasterCallback amc, void* userptr)
return 0;
}
- vstfx->plugin->dispatcher (vstfx->plugin, effOpen, 0, 0, 0, 0);
-
- /*May or May not need to 'switch the plugin on' here - unlikely
- since FST doesn't and most plugins start up 'On' by default - I think this is the least of our worries*/
-
- //vstfx->plugin->dispatcher (vstfx->plugin, effMainsChanged, 0, 1, 0, 0);
-
- vstfx->vst_version = vstfx->plugin->dispatcher (vstfx->plugin, effGetVstVersion, 0, 0, 0, 0);
+ if (!userptr) {
+ /* scanning.. or w/o master-callback userptr == 0, open now.
+ *
+ * Session::vst_callback needs a pointer to the AEffect
+ * ((VSTPlugin*)userptr)->_plugin = vstfx->plugin
+ * before calling effOpen, because effOpen may call back
+ */
+ vstfx->plugin->dispatcher (vstfx->plugin, effOpen, 0, 0, 0, 0);
+ vstfx->vst_version = vstfx->plugin->dispatcher (vstfx->plugin, effGetVstVersion, 0, 0, 0, 0);
+ }
vstfx->handle->plugincnt++;
vstfx->wantIdle = 0;