diff options
author | Robin Gareus <robin@gareus.org> | 2016-01-07 22:56:13 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-01-07 22:58:27 +0100 |
commit | 087610dc56a00003a3cb9c660cb962ff70680ce7 (patch) | |
tree | 5862f3db63a01feee03159ef34479c9a48ab0d16 /libs/ardour/windows_vst_plugin.cc | |
parent | 1973e6ec937a59c74dbef38829e22c484389112d (diff) |
Allow to query Windows VST user-preset-names
Diffstat (limited to 'libs/ardour/windows_vst_plugin.cc')
-rw-r--r-- | libs/ardour/windows_vst_plugin.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/libs/ardour/windows_vst_plugin.cc b/libs/ardour/windows_vst_plugin.cc index abca61155e..46097e7feb 100644 --- a/libs/ardour/windows_vst_plugin.cc +++ b/libs/ardour/windows_vst_plugin.cc @@ -19,6 +19,10 @@ #include "fst.h" +#include <glibmm/fileutils.h> +#include <glibmm/miscutils.h> + +#include "ardour/filesystem_paths.h" #include "ardour/windows_vst_plugin.h" #include "ardour/session.h" @@ -90,6 +94,37 @@ WindowsVSTPluginInfo::load (Session& session) } } +std::vector<Plugin::PresetRecord> +WindowsVSTPluginInfo::get_presets(Session&) +{ + std::vector<Plugin::PresetRecord> p; +#ifndef NO_PLUGIN_STATE + if (!Config->get_use_lxvst()) { + return p; + } + + // 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* uri = (*i)->property (X_("uri")); + XMLProperty* 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; |