From d00e4589d093ab4662a622c324b853d755988533 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 9 Jun 2012 21:06:45 +0000 Subject: [PATCH] Fix off-by-one in body_range(). git-svn-id: svn://localhost/ardour2/branches/3.0@12635 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/audioregion.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index 42a29c12af..50a38b7bad 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -623,7 +623,6 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, if (opaque()) { if (_inverse_fade_in) { - /* explicit inverse fade in curve (e.g. for constant * power), so we have to fetch it. */ @@ -655,7 +654,6 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, _fade_in->curve().get_vector (internal_offset, internal_offset + fade_in_limit, gain_buffer, fade_in_limit); } - /* Mix our newly-read data in, with the fade */ for (framecnt_t n = 0; n < fade_in_limit; ++n) { buf[n] += mixdown_buffer[n] * gain_buffer[n]; @@ -677,11 +675,11 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, } /* fetch the actual fade out */ - + _fade_out->curve().get_vector (curve_offset, curve_offset + fade_out_limit, gain_buffer, fade_out_limit); } else { - + /* no explicit inverse fade out (which is * actually a fade in), so just use (1 - fade * out) for the fade in of lower layers @@ -1831,7 +1829,7 @@ AudioRegion::find_silence (Sample threshold, framecnt_t min_length, InterThreadI Evoral::Range AudioRegion::body_range () const { - return Evoral::Range (first_frame() + _fade_in->back()->when, last_frame() - _fade_out->back()->when); + return Evoral::Range (first_frame() + _fade_in->back()->when + 1, last_frame() - _fade_out->back()->when); } void