summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-10-27 02:45:45 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-10-27 02:45:45 +0000
commit1bd4c5b3a212460eed1773f6b049d18c89625565 (patch)
treeda181d9467ff9de737b170576b194852f83e8f1e /libs
parente9b7cc1a429f8d2bc17439a0c9c6412936130c33 (diff)
new automation state model, sort of working, but not really
git-svn-id: svn://localhost/ardour2/trunk@1031 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/automation_event.cc82
-rw-r--r--libs/ardour/io.cc12
-rw-r--r--libs/ardour/panner.cc6
3 files changed, 30 insertions, 70 deletions
diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc
index 50c429ca70..f94a1f7cc3 100644
--- a/libs/ardour/automation_event.cc
+++ b/libs/ardour/automation_event.cc
@@ -1141,70 +1141,40 @@ AutomationList::get_state ()
int
AutomationList::set_state (const XMLNode& node)
{
- const XMLNodeList& elist = node.children();
- XMLNodeConstIterator i;
- XMLProperty* prop;
+ if (node.name() != X_("events")) {
+ warning << _("automation list: passed XML node not called \"events\" - ignored.") << endmsg;
+ return -1;
+ }
freeze ();
-
clear ();
-
- for (i = elist.begin(); i != elist.end(); ++i) {
-
- if ((*i)->name() == X_("events")) {
- /* new style */
-
- if (!node.content().empty()) {
-
- stringstream str (node.content());
-
- double x;
- double y;
- bool ok = true;
-
-
- while (str) {
- str >> x;
- if (!str) {
- ok = false;
- break;
- }
- str >> y;
- if (!str) {
- ok = false;
- break;
- }
- add (x, y);
- }
-
- if (!ok) {
- clear ();
- error << _("automation list: cannot load coordinates from XML, all points ignored") << endmsg;
- }
- }
-
- } else {
-
- /* old style */
-
- nframes_t x;
- double y;
-
- if ((prop = (*i)->property ("x")) == 0) {
- error << _("automation list: no x-coordinate stored for control point (point ignored)") << endmsg;
- continue;
+ if (!node.content().empty()) {
+
+ stringstream str (node.content());
+
+ double x;
+ double y;
+ bool ok = true;
+
+ while (str) {
+ str >> x;
+ if (!str) {
+ ok = false;
+ break;
}
- x = atoi (prop->value().c_str());
-
- if ((prop = (*i)->property ("y")) == 0) {
- error << _("automation list: no y-coordinate stored for control point (point ignored)") << endmsg;
- continue;
+ str >> y;
+ if (!str) {
+ ok = false;
+ break;
}
- y = atof (prop->value().c_str());
-
add (x, y);
}
+
+ if (!ok) {
+ clear ();
+ error << _("automation list: cannot load coordinates from XML, all points ignored") << endmsg;
+ }
}
thaw ();
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 38259c97e8..6cc279a046 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -1589,7 +1589,8 @@ IO::set_state (const XMLNode& node)
}
if ((*iter)->name() == X_("Automation")) {
- set_automation_state (*(*iter));
+
+ set_automation_state (*(*iter)->children().front());
}
if ((*iter)->name() == X_("gaincontrol")) {
@@ -1649,14 +1650,7 @@ IO::set_state (const XMLNode& node)
int
IO::set_automation_state (const XMLNode& node)
{
- /* IO has only one automation sub-node, and it should always be the
- first one (i.e. derived classes should always call
- IO::set_automation_state() if they need the IO's automation
- state. Note that Plugin + Insert Redirects do not need this, so they
- don't call it at all, though Sends do.
- */
-
- return _gain_automation_curve.set_state (*node.children().front());
+ return _gain_automation_curve.set_state (node);
}
XMLNode&
diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc
index 6d9faa92b7..faf2e03e2f 100644
--- a/libs/ardour/panner.cc
+++ b/libs/ardour/panner.cc
@@ -511,7 +511,7 @@ EqualPowerStereoPanner::set_state (const XMLNode& node)
if ((*iter)->name() == X_("panner")) {
_control.set_state (**iter);
} else if ((*iter)->name() == X_("Automation")) {
- _automation.set_state (**iter);
+ _automation.set_state (*((*iter)->children().front()));
}
}
@@ -1028,10 +1028,6 @@ Panner::state (bool full)
XMLNode* root = new XMLNode (X_("Panner"));
char buf[32];
- for (iterator p = begin(); p != end(); ++p) {
- root->add_child_nocopy ((*p)->state (full));
- }
-
root->add_property (X_("linked"), (_linked ? "yes" : "no"));
snprintf (buf, sizeof (buf), "%d", _link_direction);
root->add_property (X_("link_direction"), buf);