summaryrefslogtreecommitdiff
path: root/libs/ardour/ladspa_plugin.cc
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2016-08-25 14:22:41 +1000
committerTim Mayberry <mojofunk@gmail.com>2017-04-19 09:36:49 +1000
commit070a73c975b40d875d46a749ea67545c8ff2a25c (patch)
tree9aa593414ac65912fea854d9d3dded60098f73b6 /libs/ardour/ladspa_plugin.cc
parent64e1bf5ab793a7df5e2f4c2d68d2a280f8570470 (diff)
Use XMLNode::get/set_property API in ARDOUR::LadpsaPlugin
Diffstat (limited to 'libs/ardour/ladspa_plugin.cc')
-rw-r--r--libs/ardour/ladspa_plugin.cc26
1 files changed, 9 insertions, 17 deletions
diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc
index 075dc4b579..f2bfe530e0 100644
--- a/libs/ardour/ladspa_plugin.cc
+++ b/libs/ardour/ladspa_plugin.cc
@@ -347,7 +347,6 @@ void
LadspaPlugin::add_state (XMLNode* root) const
{
XMLNode *child;
- char buf[32];
LocaleGuard lg;
for (uint32_t i = 0; i < parameter_count(); ++i){
@@ -356,10 +355,8 @@ LadspaPlugin::add_state (XMLNode* root) const
LADSPA_IS_PORT_CONTROL(port_descriptor (i))){
child = new XMLNode("Port");
- snprintf(buf, sizeof(buf), "%u", i);
- child->add_property("number", string(buf));
- snprintf(buf, sizeof(buf), "%+f", _shadow_data[i]);
- child->add_property("value", string(buf));
+ child->set_property("number", i);
+ child->set_property("value", _shadow_data[i]);
root->add_child_nocopy (*child);
}
}
@@ -374,12 +371,8 @@ LadspaPlugin::set_state (const XMLNode& node, int version)
#ifndef NO_PLUGIN_STATE
XMLNodeList nodes;
- XMLProperty const * prop;
XMLNodeConstIterator iter;
XMLNode *child;
- const char *port;
- const char *data;
- uint32_t port_id;
#endif
LocaleGuard lg;
@@ -396,21 +389,20 @@ LadspaPlugin::set_state (const XMLNode& node, int version)
child = *iter;
- if ((prop = child->property("number")) != 0) {
- port = prop->value().c_str();
- } else {
+ uint32_t port_id;
+ float value;
+
+ if (!child->get_property ("number", port_id)) {
warning << _("LADSPA: no ladspa port number") << endmsg;
continue;
}
- if ((prop = child->property("value")) != 0) {
- data = prop->value().c_str();
- } else {
+
+ if (!child->get_property ("value", value)) {
warning << _("LADSPA: no ladspa port data") << endmsg;
continue;
}
- sscanf (port, "%" PRIu32, &port_id);
- set_parameter (port_id, atof(data));
+ set_parameter (port_id, value);
}
#endif