From 085ffef1066921e4f9496c2d095f0a2dc1c69b42 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 7 Jan 2016 21:05:14 +0100 Subject: [PATCH] LADSPA preset discovery --- libs/ardour/ardour/ladspa_plugin.h | 1 + libs/ardour/ladspa_plugin.cc | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index 8c4a96668e..3336a31bf4 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -151,6 +151,7 @@ class LIBARDOUR_API LadspaPluginInfo : public PluginInfo { ~LadspaPluginInfo () { }; PluginPtr load (Session& session); + virtual std::vector get_presets(Session& session); }; typedef boost::shared_ptr LadspaPluginInfoPtr; diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc index 88f40c1f84..6ec0723248 100644 --- a/libs/ardour/ladspa_plugin.cc +++ b/libs/ardour/ladspa_plugin.cc @@ -738,6 +738,29 @@ LadspaPluginInfo::load (Session& session) } } +std::vector +LadspaPluginInfo::get_presets(Session& session) +{ + std::vector p; +#if (defined HAVE_LRDF && !defined NO_PLUGIN_STATE) + if (!isdigit (unique_id[0])) { + return p; + } + uint32_t id = atol (unique_id); + lrdf_uris* set_uris = lrdf_get_setting_uris(id); + + if (set_uris) { + for (uint32_t i = 0; i < (uint32_t) set_uris->count; ++i) { + if (char* label = lrdf_get_label (set_uris->items[i])) { + p.push_back (Plugin::PresetRecord (set_uris->items[i], label)); + } + } + lrdf_free_uris(set_uris); + } +#endif + return p; +} + LadspaPluginInfo::LadspaPluginInfo() { type = ARDOUR::LADSPA;