summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2020-05-12 10:07:24 -0600
committerPaul Davis <paul@linuxaudiosystems.com>2020-05-12 11:34:37 -0600
commit98a3a96d409a3201107ad7aab2c67cb070c1e9cc (patch)
tree733a09b1a19046911f84afdca130e9fe8996e751 /libs
parent7138e76d2d86881c5d6b92b63e61802e112b3b97 (diff)
use more standard mechanism for "squishing" start of audio read into loop range
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/disk_reader.cc12
1 files changed, 3 insertions, 9 deletions
diff --git a/libs/ardour/disk_reader.cc b/libs/ardour/disk_reader.cc
index 29e53df87a..a911870ebf 100644
--- a/libs/ardour/disk_reader.cc
+++ b/libs/ardour/disk_reader.cc
@@ -972,7 +972,6 @@ DiskReader::audio_read (Sample* sum_buffer,
/* XXX we don't currently play loops in reverse. not sure why */
if (!reversed) {
- samplecnt_t loop_length = 0;
/* 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) {
loop_start = loc->start ();
loop_end = loc->end ();
- loop_length = loop_end - loop_start;
- }
-
- /* if we are looping, ensure that the first sample we read is at the
- * correct position within the loop.
- */
- if (loc && start >= loop_end) {
- start = loop_start + ((start - loop_start) % loop_length);
+ /* Evoral::Range has inclusive range semantics. Ugh. Hence the -1 */
+ const Evoral::Range<samplepos_t> loop_range (loop_start, loop_end - 1);
+ start = loop_range.squish (start);
}
}