diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-10-27 00:31:38 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-10-27 00:31:38 +0000 |
commit | e9b7cc1a429f8d2bc17439a0c9c6412936130c33 (patch) | |
tree | 6080844e378acebc02a1d6b25e3a9197cf0f1bbb /libs/ardour/automation_event.cc | |
parent | 3933ca6c17e2159ab7aa89d68431e228177ca134 (diff) |
restore compilability amidst automation state mgmt changes
git-svn-id: svn://localhost/ardour2/trunk@1030 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/automation_event.cc')
-rw-r--r-- | libs/ardour/automation_event.cc | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc index c82a95e058..50c429ca70 100644 --- a/libs/ardour/automation_event.cc +++ b/libs/ardour/automation_event.cc @@ -1122,6 +1122,10 @@ AutomationList::get_state () XMLNode* node = new XMLNode (X_("events")); iterator xx; + if (events.empty()) { + return *node; + } + for (xx = events.begin(); xx != events.end(); ++xx) { str << (double) (*xx)->when; str << ' '; @@ -1151,35 +1155,39 @@ AutomationList::set_state (const XMLNode& node) /* new style */ - stringstream str (node.content()); - - double x; - double y; - bool ok = true; - - while (str) { - str >> x; - if (!str) { - ok = false; - break; + 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); } - str >> y; - if (!str) { - ok = false; - break; + + if (!ok) { + clear (); + error << _("automation list: cannot load coordinates from XML, all points ignored") << endmsg; } - 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; |