13
0

Use XMLNode::get/set_property API in ARDOUR::VCA class

This commit is contained in:
Tim Mayberry 2016-08-28 22:07:50 +10:00
parent e8d0c2324f
commit 161cd4f3cd

View File

@ -114,8 +114,8 @@ XMLNode&
VCA::get_state () VCA::get_state ()
{ {
XMLNode* node = new XMLNode (xml_node_name); XMLNode* node = new XMLNode (xml_node_name);
node->add_property (X_("name"), _name); node->set_property (X_("name"), name());
node->add_property (X_("number"), _number); node->set_property (X_("number"), _number);
node->add_child_nocopy (_presentation_info.get_state()); node->add_child_nocopy (_presentation_info.get_state());
@ -132,35 +132,30 @@ VCA::get_state ()
int int
VCA::set_state (XMLNode const& node, int version) VCA::set_state (XMLNode const& node, int version)
{ {
XMLProperty const* prop;
Stripable::set_state (node, version); Stripable::set_state (node, version);
if ((prop = node.property ("name")) != 0) { std::string str;
set_name (prop->value()); if (node.get_property ("name", str)) {
set_name (str);
} }
if ((prop = node.property ("number")) != 0) { node.get_property ("number", _number);
_number = atoi (prop->value());
}
XMLNodeList const &children (node.children()); XMLNodeList const &children (node.children());
for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) { for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) {
if ((*i)->name() == Controllable::xml_node_name) { if ((*i)->name() == Controllable::xml_node_name) {
XMLProperty* prop = (*i)->property ("name"); if (!(*i)->get_property ("name", str)) {
if (!prop) {
continue; continue;
} }
if (prop->value() == _gain_control->name()) { if (str == _gain_control->name()) {
_gain_control->set_state (**i, version); _gain_control->set_state (**i, version);
} }
if (prop->value() == _solo_control->name()) { if (str == _solo_control->name()) {
_solo_control->set_state (**i, version); _solo_control->set_state (**i, version);
} }
if (prop->value() == _mute_control->name()) { if (str == _mute_control->name()) {
_mute_control->set_state (**i, version); _mute_control->set_state (**i, version);
} }
} else if ((*i)->name() == Slavable::xml_node_name) { } else if ((*i)->name() == Slavable::xml_node_name) {