X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fmac_vst_plugin.cc;h=0b52096e6aff7951ebbdaf87742cca0241a71cdc;hb=baa00942a20856cf332f547086ed5ebd2ff9078e;hp=08c39b1d354b31f55ee2f7a957aaf484bcfb5d85;hpb=8b93fb02f38148c25c91ed41a4f12735be38dbf0;p=ardour.git diff --git a/libs/ardour/mac_vst_plugin.cc b/libs/ardour/mac_vst_plugin.cc index 08c39b1d35..0b52096e6a 100644 --- a/libs/ardour/mac_vst_plugin.cc +++ b/libs/ardour/mac_vst_plugin.cc @@ -40,9 +40,10 @@ MacVSTPlugin::MacVSTPlugin (AudioEngine& e, Session& session, VSTHandle* h, int if ((_state = mac_vst_instantiate (_handle, Session::vst_callback, this)) == 0) { throw failed_constructor (); } + open_plugin (); Session::vst_current_loading_id = 0; - set_plugin (_state->plugin); + init_plugin (); } MacVSTPlugin::MacVSTPlugin (const MacVSTPlugin &other) @@ -54,11 +55,15 @@ MacVSTPlugin::MacVSTPlugin (const MacVSTPlugin &other) if ((_state = mac_vst_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 ()); + other.add_state (root); + set_state (*root, Stateful::loading_state_version); + delete root; - // Plugin::setup_controls (); + init_plugin (); } MacVSTPlugin::~MacVSTPlugin () @@ -66,6 +71,13 @@ MacVSTPlugin::~MacVSTPlugin () mac_vst_close (_state); } +void +MacVSTPlugin::open_plugin () +{ + VSTPlugin::open_plugin (); + _plugin->dispatcher (_plugin, effCanDo, 0, 0, const_cast ("hasCockosViewAsConfig"), 0.0f); +} + PluginPtr MacVSTPluginInfo::load (Session& session) { @@ -114,6 +126,7 @@ MacVSTPluginInfo::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->ptr1 = NULL; plugin->dispatcher (plugin, effOpen, 0, 0, 0, 0); // :( int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, NULL, 0);