X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fwindows_vst_plugin.cc;h=17cfa1eed7c4120f2070ba3080b21ceabf536ca5;hb=cf52d6e4b40111eb04b244ec054055a4ec15dbe0;hp=03170e0d04a6db3a25889c9adf53d2b3a704cb15;hpb=2e0c98c48903c67fcef7abd77a7c53f3f2d41e2f;p=ardour.git diff --git a/libs/ardour/windows_vst_plugin.cc b/libs/ardour/windows_vst_plugin.cc index 03170e0d04..17cfa1eed7 100644 --- a/libs/ardour/windows_vst_plugin.cc +++ b/libs/ardour/windows_vst_plugin.cc @@ -19,10 +19,14 @@ #include "fst.h" +#include +#include + +#include "ardour/filesystem_paths.h" #include "ardour/windows_vst_plugin.h" #include "ardour/session.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using namespace ARDOUR; @@ -50,7 +54,7 @@ WindowsVSTPlugin::WindowsVSTPlugin (const WindowsVSTPlugin &other) throw failed_constructor(); } Session::vst_current_loading_id = 0; - + _plugin = _state->plugin; } @@ -71,7 +75,7 @@ WindowsVSTPluginInfo::load (Session& session) handle = fst_load(path.c_str()); - if ((int) handle == -1) { + if (!handle) { error << string_compose(_("VST: cannot load module from \"%1\""), path) << endmsg; } else { plugin.reset (new WindowsVSTPlugin (session.engine(), session, handle, PBD::atoi(unique_id))); @@ -90,6 +94,39 @@ WindowsVSTPluginInfo::load (Session& session) } } +std::vector +WindowsVSTPluginInfo::get_presets (bool user_only) const +{ + std::vector p; +#ifndef NO_PLUGIN_STATE + if (!Config->get_use_lxvst()) { + return p; + } + + if (!user_only) { + // TODO cache and load factory-preset names + } + + /* user presets */ + XMLTree* t = new XMLTree; + std::string pf = Glib::build_filename (ARDOUR::user_config_directory (), "presets", string_compose ("vst-%1", unique_id)); + if (Glib::file_test (pf, Glib::FILE_TEST_EXISTS)) { + t->set_filename (pf); + if (t->read ()) { + XMLNode* root = t->root (); + for (XMLNodeList::const_iterator i = root->children().begin(); i != root->children().end(); ++i) { + XMLProperty const * uri = (*i)->property (X_("uri")); + XMLProperty const * label = (*i)->property (X_("label")); + p.push_back (Plugin::PresetRecord (uri->value(), label->value(), true)); + } + } + } + delete t; +#endif + + return p; +} + WindowsVSTPluginInfo::WindowsVSTPluginInfo() { type = ARDOUR::Windows_VST;