diff options
author | Robin Gareus <robin@gareus.org> | 2017-03-06 23:49:40 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-03-07 00:13:56 +0100 |
commit | e1095310a8186bbd977534285df0ab29423d3aa3 (patch) | |
tree | eae28a2a01773762ae77bf7b12c1270df7d468cb /libs/ardour/mac_vst_support.cc | |
parent | 589c13c0eb9f6003a7e8cf923110459c897ea4b0 (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/mac_vst_support.cc')
-rw-r--r-- | libs/ardour/mac_vst_support.cc | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/libs/ardour/mac_vst_support.cc b/libs/ardour/mac_vst_support.cc index 686c54f747..ae40e53a71 100644 --- a/libs/ardour/mac_vst_support.cc +++ b/libs/ardour/mac_vst_support.cc @@ -203,17 +203,19 @@ mac_vst_instantiate (VSTHandle* fhandle, audioMasterCallback amc, void* userptr) return 0; } - mac_vst->plugin->dispatcher (mac_vst->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*/ - - //mac_vst->plugin->dispatcher (mac_vst->plugin, effMainsChanged, 0, 1, 0, 0); - - /* configure plugin to use Cocoa View */ - mac_vst->plugin->dispatcher (mac_vst->plugin, effCanDo, 0, 0, const_cast<char*> ("hasCockosViewAsConfig"), 0.0f); - - mac_vst->vst_version = mac_vst->plugin->dispatcher (mac_vst->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 + */ + mac_vst->plugin->dispatcher (mac_vst->plugin, effOpen, 0, 0, 0, 0); + mac_vst->vst_version = mac_vst->plugin->dispatcher (mac_vst->plugin, effGetVstVersion, 0, 0, 0, 0); + + /* configure plugin to use Cocoa View */ + mac_vst->plugin->dispatcher (mac_vst->plugin, effCanDo, 0, 0, const_cast<char*> ("hasCockosViewAsConfig"), 0.0f); + } mac_vst->handle->plugincnt++; mac_vst->wantIdle = 0; |