add to LUA API (new Stripable API)
[ardour.git] / libs / ardour / lxvst_plugin.cc
index 4b32e47bb5672e12874be7e9b7a1b4feadf59da6..62fff3f8b87c039fb6bb865e781dfdaf81e08d78 100644 (file)
@@ -25,7 +25,7 @@
 #include "ardour/session.h"
 #include "ardour/lxvst_plugin.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
@@ -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,11 +55,15 @@ 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 ());
+       other.add_state (root);
+       set_state (*root, Stateful::loading_state_version);
+       delete root;
 
-       // Plugin::setup_controls ();
+       init_plugin ();
 }
 
 LXVSTPlugin::~LXVSTPlugin ()
@@ -114,6 +119,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->ptr1 = NULL;
 
                plugin->dispatcher (plugin, effOpen, 0, 0, 0, 0); // :(
                int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, NULL, 0);