From fdb6d217e93dc0ac20c0efc4eca65a5ce63db72b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 13 Oct 2008 15:56:48 +0000 Subject: 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 --- libs/ardour/audioregion.cc | 1 - libs/ardour/rb_effect.cc | 4 ++-- libs/ardour/region.cc | 14 +++++++++++++- svn_revision.h | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index 07965df4f3..ecb2f9b4b3 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -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" */ } diff --git a/libs/ardour/rb_effect.cc b/libs/ardour/rb_effect.cc index 280eabda64..91bc6ba78a 100644 --- a/libs/ardour/rb_effect.cc +++ b/libs/ardour/rb_effect.cc @@ -199,7 +199,7 @@ RBEffect::run (boost::shared_ptr 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 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; } } diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 129568a4c9..5efa20c8d7 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -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; } diff --git a/svn_revision.h b/svn_revision.h index b28a7f7ab1..c89592b652 100644 --- a/svn_revision.h +++ b/svn_revision.h @@ -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 -- cgit v1.2.3