summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-10-31 16:05:53 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-10-31 16:05:53 +0000
commit186a5a23716bec8c5a9c576ce3924c430bef7b31 (patch)
treef2d62d87a6ad5e861c7381acc7dc39566f43b3ca /libs
parent71c94e69438c7c282b2dcac5ead080119944b290 (diff)
fix crashes when loading ardour 0.99 sessions, restore back compatibility for region envelopes from 0.99; slightly more debugging when libsndfile can't seek
git-svn-id: svn://localhost/ardour2/trunk@1035 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/audioregion.cc6
-rw-r--r--libs/ardour/automation_event.cc36
-rw-r--r--libs/ardour/sndfilesource.cc4
3 files changed, 37 insertions, 9 deletions
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index 552218f824..7b6d576f35 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -694,15 +694,13 @@ AudioRegion::set_live_state (const XMLNode& node, Change& what_changed, bool sen
_envelope.clear ();
- if ((prop = child->property ("default")) != 0) {
+ if ((prop = child->property ("default")) != 0 || _envelope.set_state (*child)) {
set_default_envelope ();
- } else {
- _envelope.set_state (*child);
}
_envelope.set_max_xval (_length);
_envelope.truncate_end (_length);
-
+
} else if (child->name() == "FadeIn") {
_fade_in.clear ();
diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc
index dfa3d078a8..1d61f90d9d 100644
--- a/libs/ardour/automation_event.cc
+++ b/libs/ardour/automation_event.cc
@@ -610,10 +610,6 @@ AutomationList::truncate_end (double last_coordinate)
double last_val;
if (events.empty()) {
- fatal << _("programming error:")
- << "AutomationList::truncate_end() called on an empty list"
- << endmsg;
- /*NOTREACHED*/
return;
}
@@ -1258,6 +1254,38 @@ AutomationList::set_state (const XMLNode& node)
return deserialize_events (node);
}
+ if (node.name() == X_("Envelope")) {
+
+ /* old school */
+
+ const XMLNodeList& elist = node.children();
+ XMLNodeConstIterator i;
+ XMLProperty* prop;
+ jack_nframes_t x;
+ double y;
+
+ clear ();
+
+ for (i = elist.begin(); i != elist.end(); ++i) {
+
+ if ((prop = (*i)->property ("x")) == 0) {
+ error << _("automation list: no x-coordinate stored for control point (point ignored)") << endmsg;
+ continue;
+ }
+ 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;
+ }
+ y = atof (prop->value().c_str());
+
+ add (x, y);
+ }
+
+ return 0;
+ }
+
if (node.name() != X_("AutomationList") ) {
error << string_compose (_("AutomationList: passed XML node called %1, not \"AutomationList\" - ignored"), node.name()) << endmsg;
return -1;
diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc
index df8eb3a32f..0443ffcc55 100644
--- a/libs/ardour/sndfilesource.cc
+++ b/libs/ardour/sndfilesource.cc
@@ -508,7 +508,9 @@ nframes_t
SndFileSource::write_float (Sample* data, nframes_t frame_pos, nframes_t cnt)
{
if (sf_seek (sf, frame_pos, SEEK_SET|SFM_WRITE) != frame_pos) {
- error << string_compose (_("%1: cannot seek to %2"), _path, frame_pos) << endmsg;
+ char errbuf[256];
+ sf_error_str (0, errbuf, sizeof (errbuf) - 1);
+ error << string_compose (_("%1: cannot seek to %2 (libsndfile error: %3"), _path, frame_pos, errbuf) << endmsg;
return 0;
}