Use XMLNode::get/set_property API in ARDOUR::LadpsaPlugin

This commit is contained in:
Tim Mayberry 2016-08-25 14:22:41 +10:00
parent 64e1bf5ab7
commit 070a73c975

View file

@ -347,7 +347,6 @@ void
LadspaPlugin::add_state (XMLNode* root) const LadspaPlugin::add_state (XMLNode* root) const
{ {
XMLNode *child; XMLNode *child;
char buf[32];
LocaleGuard lg; LocaleGuard lg;
for (uint32_t i = 0; i < parameter_count(); ++i){ 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))){ LADSPA_IS_PORT_CONTROL(port_descriptor (i))){
child = new XMLNode("Port"); child = new XMLNode("Port");
snprintf(buf, sizeof(buf), "%u", i); child->set_property("number", i);
child->add_property("number", string(buf)); child->set_property("value", _shadow_data[i]);
snprintf(buf, sizeof(buf), "%+f", _shadow_data[i]);
child->add_property("value", string(buf));
root->add_child_nocopy (*child); root->add_child_nocopy (*child);
} }
} }
@ -374,12 +371,8 @@ LadspaPlugin::set_state (const XMLNode& node, int version)
#ifndef NO_PLUGIN_STATE #ifndef NO_PLUGIN_STATE
XMLNodeList nodes; XMLNodeList nodes;
XMLProperty const * prop;
XMLNodeConstIterator iter; XMLNodeConstIterator iter;
XMLNode *child; XMLNode *child;
const char *port;
const char *data;
uint32_t port_id;
#endif #endif
LocaleGuard lg; LocaleGuard lg;
@ -396,21 +389,20 @@ LadspaPlugin::set_state (const XMLNode& node, int version)
child = *iter; child = *iter;
if ((prop = child->property("number")) != 0) { uint32_t port_id;
port = prop->value().c_str(); float value;
} else {
if (!child->get_property ("number", port_id)) {
warning << _("LADSPA: no ladspa port number") << endmsg; warning << _("LADSPA: no ladspa port number") << endmsg;
continue; continue;
} }
if ((prop = child->property("value")) != 0) {
data = prop->value().c_str(); if (!child->get_property ("value", value)) {
} else {
warning << _("LADSPA: no ladspa port data") << endmsg; warning << _("LADSPA: no ladspa port data") << endmsg;
continue; continue;
} }
sscanf (port, "%" PRIu32, &port_id); set_parameter (port_id, value);
set_parameter (port_id, atof(data));
} }
#endif #endif