From d72f97fb34e0b52bdc7044e91e730fb958fd84aa Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 13 Nov 2008 22:52:41 +0000 Subject: Save symbols along with indices for LV2 ports (as required by LV2r3). git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4157 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/lv2_plugin.h | 2 ++ libs/ardour/insert.cc | 7 +++++++ libs/ardour/lv2_plugin.cc | 14 ++++++++++++++ 3 files changed, 23 insertions(+) (limited to 'libs') diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index be584b76c3..de8eb616a1 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -65,6 +65,8 @@ class LV2Plugin : public ARDOUR::Plugin SLV2Plugin slv2_plugin() { return _plugin; } SLV2UI slv2_ui() { return _ui; } SLV2Port slv2_port(uint32_t i) { return slv2_plugin_get_port_by_index(_plugin, i); } + + const char* port_symbol(uint32_t port); const LV2_Feature* const* features() { return _features; } diff --git a/libs/ardour/insert.cc b/libs/ardour/insert.cc index 0227da8246..be4de27b01 100644 --- a/libs/ardour/insert.cc +++ b/libs/ardour/insert.cc @@ -627,6 +627,13 @@ PluginInsert::state (bool full) snprintf(buf, sizeof(buf), "%" PRIu32, *x); child->add_property("number", string(buf)); +#ifdef HAVE_SLV2 + LV2Plugin* lv2p = dynamic_cast(_plugins[0].get()); + if (lv2p) { + child->add_property("symbol", string(lv2p->port_symbol(*x))); + } +#endif + child->add_child_nocopy (automation_list (*x).state (full)); autonode->add_child_nocopy (*child); } diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 3b3cfa2594..32160abb58 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -189,6 +189,19 @@ LV2Plugin::default_value (uint32_t port) return _defaults[port]; } +const char* +LV2Plugin::port_symbol (uint32_t index) +{ + SLV2Port port = slv2_plugin_get_port_by_index(_plugin, index); + if (!port) { + error << name() << ": Invalid port index " << index << endmsg; + } + + SLV2Value sym = slv2_port_get_symbol(_plugin, port); + return slv2_value_as_string(sym); +} + + void LV2Plugin::set_parameter (uint32_t which, float val) { @@ -251,6 +264,7 @@ LV2Plugin::get_state() child = new XMLNode("port"); snprintf(buf, sizeof(buf), "%u", i); child->add_property("number", string(buf)); + child->add_property("symbol", port_symbol(i)); snprintf(buf, sizeof(buf), "%+f", _shadow_data[i]); child->add_property("value", string(buf)); root->add_child_nocopy (*child); -- cgit v1.2.3