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
This commit is contained in:
@@ -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 ();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user