remove cruft from DiskIOProcessor header
[ardour.git] / libs / ardour / windows_vst_plugin.cc
index 46097e7feb10683f4958fda12c32a8ffba3befc9..4bfe8226459699f67c921262bf8a01c8a3a517f1 100644 (file)
@@ -26,7 +26,7 @@
 #include "ardour/windows_vst_plugin.h"
 #include "ardour/session.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
@@ -39,9 +39,10 @@ WindowsVSTPlugin::WindowsVSTPlugin (AudioEngine& e, Session& session, VSTHandle*
        if ((_state = fst_instantiate (_handle, Session::vst_callback, this)) == 0) {
                throw failed_constructor();
        }
+       open_plugin ();
        Session::vst_current_loading_id = 0;
 
-       set_plugin (_state->plugin);
+       init_plugin ();
 }
 
 WindowsVSTPlugin::WindowsVSTPlugin (const WindowsVSTPlugin &other)
@@ -53,9 +54,15 @@ WindowsVSTPlugin::WindowsVSTPlugin (const WindowsVSTPlugin &other)
        if ((_state = fst_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;
+
+       init_plugin ();
 }
 
 WindowsVSTPlugin::~WindowsVSTPlugin ()
@@ -95,7 +102,7 @@ WindowsVSTPluginInfo::load (Session& session)
 }
 
 std::vector<Plugin::PresetRecord>
-WindowsVSTPluginInfo::get_presets(Session&)
+WindowsVSTPluginInfo::get_presets (bool user_only) const
 {
        std::vector<Plugin::PresetRecord> p;
 #ifndef NO_PLUGIN_STATE
@@ -103,7 +110,9 @@ WindowsVSTPluginInfo::get_presets(Session&)
                return p;
        }
 
-       // TODO cache and load factory-preset names
+       if (!user_only) {
+               // TODO cache and load factory-preset names
+       }
 
        /* user presets */
        XMLTree* t = new XMLTree;
@@ -113,8 +122,8 @@ WindowsVSTPluginInfo::get_presets(Session&)
                if (t->read ()) {
                        XMLNode* root = t->root ();
                        for (XMLNodeList::const_iterator i = root->children().begin(); i != root->children().end(); ++i) {
-                               XMLProperty* uri = (*i)->property (X_("uri"));
-                               XMLProperty* label = (*i)->property (X_("label"));
+                               XMLProperty const * uri = (*i)->property (X_("uri"));
+                               XMLProperty const * label = (*i)->property (X_("label"));
                                p.push_back (Plugin::PresetRecord (uri->value(), label->value(), true));
                        }
                }