13
0

Fix seamless looping w/split-cycles

This fixes the following (loop-lennth > internal_playback_seek
length. Due to read-ahead on some cycles the following can happen
---
Loop From: 3528000 To: 3880800  (len: 352800)
start-sample: 3880971 playback_sample: 3528171 nframes: 96
start-sample: 3880875 playback_sample: 3528075 nframes: 192
---
which resulted in disk_samples_to_consume == 0;
This commit is contained in:
Robin Gareus 2020-02-14 18:45:13 +01:00
parent 1341e18cac
commit 4c7cde0242
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -367,8 +367,14 @@ DiskReader::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
AudioBuffer& disk_buf ((ms & MonitoringInput) ? scratch_bufs.get_audio(n) : output);
if (start_sample != playback_sample && target_gain != 0) {
if (can_internal_playback_seek (start_sample - playback_sample)) {
internal_playback_seek (start_sample - playback_sample);
samplepos_t ss = start_sample;
Location* loc = _loop_location;
if (loc) {
Evoral::Range<samplepos_t> loop_range (loc->start(), loc->end() - 1);
ss = loop_range.squish (playback_sample);
}
if (can_internal_playback_seek (ss - playback_sample)) {
internal_playback_seek (ss - playback_sample);
} else {
disk_samples_to_consume = 0; /* will force an underrun below */
}