13
0

use more standard mechanism for "squishing" start of audio read into loop range

This commit is contained in:
Paul Davis 2020-05-12 10:07:24 -06:00
parent 7138e76d2d
commit 98a3a96d40

View File

@ -972,7 +972,6 @@ DiskReader::audio_read (Sample* sum_buffer,
/* XXX we don't currently play loops in reverse. not sure why */ /* XXX we don't currently play loops in reverse. not sure why */
if (!reversed) { if (!reversed) {
samplecnt_t loop_length = 0;
/* Make the use of a Location atomic for this read operation. /* Make the use of a Location atomic for this read operation.
@ -985,15 +984,10 @@ DiskReader::audio_read (Sample* sum_buffer,
if ((loc = _loop_location) != 0) { if ((loc = _loop_location) != 0) {
loop_start = loc->start (); loop_start = loc->start ();
loop_end = loc->end (); loop_end = loc->end ();
loop_length = loop_end - loop_start;
}
/* if we are looping, ensure that the first sample we read is at the /* Evoral::Range has inclusive range semantics. Ugh. Hence the -1 */
* correct position within the loop. const Evoral::Range<samplepos_t> loop_range (loop_start, loop_end - 1);
*/ start = loop_range.squish (start);
if (loc && start >= loop_end) {
start = loop_start + ((start - loop_start) % loop_length);
} }
} }