fix subtle but nasty problems with stretch/shift audio operations, and fix up handling of older sessions with illegal stretch/shift values in them

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3954 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-10-13 15:56:48 +00:00
parent 990ca13700
commit fdb6d217e9
4 changed files with 16 additions and 5 deletions

View file

@ -530,7 +530,6 @@ AudioRegion::_read_at (const SourceList& srcs, nframes_t limit,
if (chan_n < n_channels()) {
if (srcs[chan_n]->read (mixdown_buffer, _start + internal_offset, to_read) != to_read) {
return 0; /* "read nothing" */
}

View file

@ -199,7 +199,7 @@ RBEffect::run (boost::shared_ptr<AudioRegion> region)
while (pos < read_duration && !tsr.cancel) {
nframes_t this_read = 0;
for (uint32_t i = 0; i < channels; ++i) {
this_read = 0;
@ -222,7 +222,7 @@ RBEffect::run (boost::shared_ptr<AudioRegion> region)
if (this_read != this_time) {
error << string_compose
(_("tempoize: error reading data from %1 at %2 (wanted %3, got %4)"),
region->name(), pos + region->position(), this_time, this_read) << endmsg;
region->name(), this_position, this_time, this_read) << endmsg;
goto out;
}
}

View file

@ -65,7 +65,7 @@ Region::Region (nframes_t start, nframes_t length, const string& name, layer_t l
_sync_position = _start;
_length = length;
_last_length = length;
_ancestral_start = start;
_ancestral_start = 0;
_ancestral_length = length;
_stretch = 1.0;
_shift = 1.0;
@ -1021,12 +1021,24 @@ Region::set_live_state (const XMLNode& node, Change& what_changed, bool send)
if ((prop = node.property ("stretch")) != 0) {
_stretch = atof (prop->value());
/* fix problem with old sessions corrupted by an impossible
value for _stretch
*/
if (_stretch == 0.0) {
_stretch = 1.0;
}
} else {
_stretch = 1.0;
}
if ((prop = node.property ("shift")) != 0) {
_shift = atof (prop->value());
/* fix problem with old sessions corrupted by an impossible
value for _shift
*/
if (_shift == 0.0) {
_shift = 1.0;
}
} else {
_shift = 1.0;
}

View file

@ -1,4 +1,4 @@
#ifndef __ardour_svn_revision_h__
#define __ardour_svn_revision_h__
static const char* ardour_svn_revision = "3920";
static const char* ardour_svn_revision = "3930";
#endif