changes associated with save/restore of AutomationControl id's

git-svn-id: svn://localhost/ardour2/branches/3.0@8109 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2010-11-27 17:41:43 +00:00
parent 2bd721d1cc
commit f3a833e38e
7 changed files with 29 additions and 35 deletions

View File

@@ -34,6 +34,7 @@
#include "i18n.h"
using namespace ARDOUR;
using namespace PBD;
Amp::Amp (Session& s)
: Processor(s, "Amp")
@@ -388,10 +389,7 @@ Amp::state (bool full_state)
{
XMLNode& node (Processor::state (full_state));
node.add_property("type", "amp");
char buf[32];
snprintf (buf, sizeof (buf), "%2.12f", _gain_control->get_value());
node.add_property("gain", buf);
node.add_child_nocopy (_gain_control->get_state());
return node;
}
@@ -399,19 +397,14 @@ Amp::state (bool full_state)
int
Amp::set_state (const XMLNode& node, int version)
{
const XMLProperty* prop;
XMLNode* gain_node;
Processor::set_state (node, version);
prop = node.property ("gain");
if (prop) {
gain_t val;
if (sscanf (prop->value().c_str(), "%f", &val) == 1) {
_gain_control->set_value (val);
}
}
if ((gain_node = node.child (Controllable::xml_node_name.c_str())) != 0) {
_gain_control->set_state (*gain_node, version);
}
return 0;
}

View File

@@ -230,10 +230,11 @@ AudioTrack::_set_state (const XMLNode& node, int version, bool call_base)
for (niter = nlist.begin(); niter != nlist.end(); ++niter){
child = *niter;
if (child->name() == X_("recenable")) {
_rec_enable_control->set_state (*child, version);
_session.add_controllable (_rec_enable_control);
}
if (child->name() == Controllable::xml_node_name && (prop = child->property ("name")) != 0) {
if (prop->value() == X_("recenable")) {
_rec_enable_control->set_state (*child, version);
}
}
}
if (version >= 3000) {

View File

@@ -91,7 +91,7 @@ AudioTrackImporter::AudioTrackImporter (XMLTree const & source,
throw failed_constructor();
}
XMLNodeList const & controllables = node.children ("Controllable");
XMLNodeList const & controllables = node.children (Controllable::xml_node_name);
for (XMLNodeList::const_iterator it = controllables.begin(); it != controllables.end(); ++it) {
parse_controllable (**it);
}
@@ -197,7 +197,7 @@ AudioTrackImporter::parse_io ()
return false;
}
XMLNodeList const & controllables = io->children ("Controllable");
XMLNodeList const & controllables = io->children (Controllable::xml_node_name);
for (XMLNodeList::const_iterator it = controllables.begin(); it != controllables.end(); ++it) {
parse_controllable (**it);
}

View File

@@ -34,7 +34,7 @@ AutomationControl::AutomationControl(
const Evoral::Parameter& parameter,
boost::shared_ptr<ARDOUR::AutomationList> list,
const string& name)
: Controllable((name != "") ? name : EventTypeMap::instance().to_symbol(parameter))
: Controllable (name.empty() ? EventTypeMap::instance().to_symbol(parameter) : name)
, Evoral::Control(parameter, list)
, _session(session)
{

View File

@@ -159,10 +159,11 @@ MidiTrack::_set_state (const XMLNode& node, int version, bool call_base)
for (niter = nlist.begin(); niter != nlist.end(); ++niter){
child = *niter;
if (child->name() == X_("recenable")) {
_rec_enable_control->set_state (*child, version);
_session.add_controllable (_rec_enable_control);
}
if (child->name() == Controllable::xml_node_name && (prop = child->property ("name")) != 0) {
if (prop->value() == X_("recenable")) {
_rec_enable_control->set_state (*child, version);
}
}
}
if (version >= 3000) {

View File

@@ -535,7 +535,7 @@ EqualPowerStereoPanner::set_state (const XMLNode& node, int version)
for (XMLNodeConstIterator iter = node.children().begin(); iter != node.children().end(); ++iter) {
if ((*iter)->name() == X_("Controllable")) {
if ((*iter)->name() == Controllable::xml_node_name) {
if ((prop = (*iter)->property("name")) != 0 && prop->value() == "panner") {
_control->set_state (**iter, version);
}

View File

@@ -1832,6 +1832,7 @@ Route::state(bool full_state)
node->add_child_nocopy (_input->state (full_state));
node->add_child_nocopy (_output->state (full_state));
node->add_child_nocopy (_solo_control->get_state ());
node->add_child_nocopy (_mute_control->get_state ());
node->add_child_nocopy (_mute_master->get_state ());
XMLNode* remote_control_node = new XMLNode (X_("RemoteControl"));
@@ -2013,11 +2014,9 @@ Route::_set_state (const XMLNode& node, int version, bool /*call_base*/)
_extra_xml = new XMLNode (*child);
} else if (child->name() == X_("Controllable") && (prop = child->property("name")) != 0) {
} else if (child->name() == Controllable::xml_node_name && (prop = child->property("name")) != 0) {
if (prop->value() == "solo") {
_solo_control->set_state (*child, version);
_session.add_controllable (_solo_control);
}
} else if (child->name() == X_("RemoteControl")) {
@@ -2264,13 +2263,13 @@ Route::_set_state_2X (const XMLNode& node, int version)
_extra_xml = new XMLNode (*child);
} else if (child->name() == X_("Controllable") && (prop = child->property("name")) != 0) {
if (prop->value() == "solo") {
} else if (child->name() == Controllable::xml_node_name && (prop = child->property("name")) != 0) {
if (prop->value() == X_("solo")) {
_solo_control->set_state (*child, version);
_session.add_controllable (_solo_control);
}
} else if (prop->value() == X_("mute")) {
_mute_control->set_state (*child, version);
}
} else if (child->name() == X_("RemoteControl")) {
if ((prop = child->property (X_("id"))) != 0) {
int32_t x;