From 087610dc56a00003a3cb9c660cb962ff70680ce7 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 7 Jan 2016 22:56:13 +0100 Subject: Allow to query Windows VST user-preset-names --- libs/ardour/windows_vst_plugin.cc | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'libs/ardour/windows_vst_plugin.cc') 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 +#include + +#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 +WindowsVSTPluginInfo::get_presets(Session&) +{ + std::vector 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; -- cgit v1.2.3