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
This commit is contained in:
David Robillard 2008-11-13 22:52:41 +00:00
parent 427631a3f0
commit d72f97fb34
3 changed files with 23 additions and 0 deletions

View file

@ -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; }

View file

@ -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<LV2Plugin*>(_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);
}

View file

@ -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);