From f795462100cd0a16b86ffa7e07edeb166dc53abd Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 22 Nov 2018 14:58:44 +0100 Subject: [PATCH] Save LV2 Port Property values locally This keeps track of lv2:Parameter properties modified with Port:Set, currently file-paths. --- libs/ardour/ardour/lv2_plugin.h | 3 +++ libs/ardour/lv2_plugin.cc | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index f12953633b..75d07547ef 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -172,6 +172,7 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee void set_property(uint32_t key, const Variant& value); const PropertyDescriptors& get_supported_properties() const { return _property_descriptors; } const ParameterDescriptor& get_property_descriptor(uint32_t id) const; + Variant get_property_value (uint32_t) const; void announce_property_values(); private: @@ -231,6 +232,8 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee std::vector _port_minimumSize; std::map _port_indices; + std::map _property_values; + PropertyDescriptors _property_descriptors; struct AutomationCtrl { diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 3ae3140577..79bef11cdd 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -1992,6 +1992,16 @@ LV2Plugin::load_supported_properties(PropertyDescriptors& descs) lilv_nodes_free(properties); } +Variant +LV2Plugin::get_property_value (uint32_t prop_id) const +{ + std::map::const_iterator it; + if ((it = _property_values.find (prop_id)) == _property_values.end()) { + return Variant(); + } + return it->second; +} + void LV2Plugin::announce_property_values() { @@ -2944,6 +2954,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs, // Emit PropertyChanged signal for UI // TODO: This should emit the control's Changed signal PropertyChanged(prop_id, Variant(Variant::PATH, path)); + _property_values[prop_id] = Variant(Variant::PATH, path); } else { std::cerr << "warning: patch:Set for unknown property" << std::endl; }