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/lxvst_plugin.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/lxvst_plugin.cc')
-rw-r--r-- | libs/ardour/lxvst_plugin.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libs/ardour/lxvst_plugin.cc b/libs/ardour/lxvst_plugin.cc index b71f9fa378..259c5e6461 100644 --- a/libs/ardour/lxvst_plugin.cc +++ b/libs/ardour/lxvst_plugin.cc @@ -40,9 +40,10 @@ LXVSTPlugin::LXVSTPlugin (AudioEngine& e, Session& session, VSTHandle* h, int un if ((_state = vstfx_instantiate (_handle, Session::vst_callback, this)) == 0) { throw failed_constructor(); } + open_plugin (); Session::vst_current_loading_id = 0; - set_plugin (_state->plugin); + init_plugin (); } LXVSTPlugin::LXVSTPlugin (const LXVSTPlugin &other) @@ -54,17 +55,16 @@ LXVSTPlugin::LXVSTPlugin (const LXVSTPlugin &other) if ((_state = vstfx_instantiate (_handle, Session::vst_callback, this)) == 0) { throw failed_constructor(); } + open_plugin (); Session::vst_current_loading_id = 0; - _plugin = _state->plugin; - XMLNode* root = new XMLNode (other.state_node_name ()); LocaleGuard lg; other.add_state (root); set_state (*root, Stateful::loading_state_version); delete root; - set_plugin (_state->plugin); + init_plugin (); } LXVSTPlugin::~LXVSTPlugin () @@ -120,6 +120,7 @@ LXVSTPluginInfo::get_presets (bool user_only) const Session::vst_current_loading_id = atoi (unique_id); AEffect* plugin = handle->main_entry (Session::vst_callback); Session::vst_current_loading_id = 0; + plugin->user = NULL; plugin->dispatcher (plugin, effOpen, 0, 0, 0, 0); // :( int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, NULL, 0); |