summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorJesse Chappell <jesse@essej.net>2007-01-18 06:39:22 +0000
committerJesse Chappell <jesse@essej.net>2007-01-18 06:39:22 +0000
commit851d1fa76a4b9a67b5890ea36380029eaa1fb45f (patch)
tree8b56815d56cbc1f030d2b0e65303e86e075c7a0e /libs
parentf7d48b79f1fa28ce1e8f8862ad0d599d497c1ec6 (diff)
Fixed midi controllable state saving/loading
git-svn-id: svn://localhost/ardour2/trunk@1356 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/session.h1
-rw-r--r--libs/ardour/control_protocol_manager.cc23
-rw-r--r--libs/ardour/io.cc6
-rw-r--r--libs/ardour/panner.cc7
-rw-r--r--libs/ardour/route.cc18
-rw-r--r--libs/ardour/session_state.cc14
6 files changed, 40 insertions, 29 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index ae4a64802f..92687c7dc0 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -1697,7 +1697,6 @@ class Session : public PBD::StatefulDestructible
void config_changed (const char*);
- void add_control_protocol (const ControlProtocolInfo* const, XMLNode*);
XMLNode& get_control_protocol_state ();
};
diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc
index de177d0e3d..72f56794d7 100644
--- a/libs/ardour/control_protocol_manager.cc
+++ b/libs/ardour/control_protocol_manager.cc
@@ -324,10 +324,25 @@ ControlProtocolManager::get_state (void)
Glib::Mutex::Lock lm (protocols_lock);
for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) {
- XMLNode* child = new XMLNode (X_("Protocol"));
- child->add_property (X_("name"), (*i)->name);
- child->add_property (X_("active"), (*i)->protocol ? "yes" : "no");
- root->add_child_nocopy (*child);
+
+ XMLNode * child;
+
+ if ((*i)->protocol) {
+ child = &((*i)->protocol->get_state());
+ child->add_property (X_("active"), "yes");
+ // should we update (*i)->state here? probably.
+ root->add_child_nocopy (*child);
+ }
+ else if ((*i)->state) {
+ // keep ownership clear
+ root->add_child_copy (*(*i)->state);
+ }
+ else {
+ child = new XMLNode (X_("Protocol"));
+ child->add_property (X_("name"), (*i)->name);
+ child->add_property (X_("active"), "no");
+ root->add_child_nocopy (*child);
+ }
}
return *root;
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index b4d9db97eb..5e99a14fad 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -1634,8 +1634,10 @@ IO::set_state (const XMLNode& node)
set_automation_state (*(*iter)->children().front());
}
- if ((*iter)->name() == X_("gaincontrol")) {
- _gain_control.set_state (**iter);
+ if ((*iter)->name() == X_("controllable")) {
+ if ((prop = (*iter)->property("name")) != 0 && prop->value() == "gaincontrol") {
+ _gain_control.set_state (**iter);
+ }
}
}
diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc
index 97646d99cd..09974a9529 100644
--- a/libs/ardour/panner.cc
+++ b/libs/ardour/panner.cc
@@ -534,9 +534,10 @@ EqualPowerStereoPanner::set_state (const XMLNode& node)
for (XMLNodeConstIterator iter = node.children().begin(); iter != node.children().end(); ++iter) {
- if ((*iter)->name() == X_("panner")) {
-
- _control.set_state (**iter);
+ if ((*iter)->name() == X_("controllable")) {
+ if ((prop = (*iter)->property("name")) != 0 && prop->value() == "panner") {
+ _control.set_state (**iter);
+ }
} else if ((*iter)->name() == X_("Automation")) {
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index a322c10068..d3097dd776 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -1687,13 +1687,19 @@ Route::_set_state (const XMLNode& node, bool call_base)
_comment = cmt->content();
} else if (child->name() == X_("extra")) {
+
_extra_xml = new XMLNode (*child);
- } else if (child->name() == X_("solo")) {
- _solo_control.set_state (*child);
- _session.add_controllable (&_solo_control);
- } else if (child->name() == X_("mute")) {
- _mute_control.set_state (*child);
- _session.add_controllable (&_mute_control);
+
+ } else if (child->name() == X_("controllable") && (prop = child->property("name")) != 0) {
+
+ if (prop->value() == "solo") {
+ _solo_control.set_state (*child);
+ _session.add_controllable (&_solo_control);
+ }
+ else if (prop->value() == "mute") {
+ _mute_control.set_state (*child);
+ _session.add_controllable (&_mute_control);
+ }
}
}
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 1f8d20e16a..3b66f65cec 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -1040,19 +1040,7 @@ XMLNode&
Session::get_control_protocol_state ()
{
ControlProtocolManager& cpm (ControlProtocolManager::instance());
- XMLNode* node = new XMLNode (X_("ControlProtocols"));
-
- cpm.foreach_known_protocol (bind (mem_fun (*this, &Session::add_control_protocol), node));
-
- return *node;
-}
-
-void
-Session::add_control_protocol (const ControlProtocolInfo* const cpi, XMLNode* node)
-{
- if (cpi->protocol) {
- node->add_child_nocopy (cpi->protocol->get_state());
- }
+ return cpm.get_state();
}
int