13
0

Opaque region bodies should overwrite whatever is already in

the buffer; fix crash when the sum of the fade in and out
is longer than the region.


git-svn-id: svn://localhost/ardour2/branches/3.0@12410 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2012-05-24 00:54:51 +00:00
parent ba56c4bd03
commit 37bc04f230

View File

@ -586,8 +586,8 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
/* READ DATA FROM THE SOURCE INTO mixdown_buffer.
We can never read directly into buf, since it may contain data
from a transparent region `below' this one in the stack; we
must always mix.
from a region `below' this one in the stack, and our fades (if they exist)
may need to mix with the existing data.
*/
if (read_from_sources (_sources, _length, mixdown_buffer, position, to_read, chan_n) != to_read) {
@ -706,7 +706,14 @@ AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
/* MIX THE REGION BODY FROM mixdown_buffer INTO buf */
mix_buffers_no_gain (buf + fade_in_limit, mixdown_buffer + fade_in_limit, to_read - fade_in_limit - fade_out_limit);
framecnt_t const N = to_read - fade_in_limit - fade_out_limit;
if (N > 0) {
if (opaque ()) {
memcpy (buf + fade_in_limit, mixdown_buffer + fade_in_limit, N * sizeof (Sample));
} else {
mix_buffers_no_gain (buf + fade_in_limit, mixdown_buffer + fade_in_limit, N);
}
}
return to_read;
}