summaryrefslogtreecommitdiff
path: root/libs/ardour/disk_reader.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/disk_reader.cc')
-rw-r--r--libs/ardour/disk_reader.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/libs/ardour/disk_reader.cc b/libs/ardour/disk_reader.cc
index fadd5c865b..95f926497d 100644
--- a/libs/ardour/disk_reader.cc
+++ b/libs/ardour/disk_reader.cc
@@ -776,6 +776,17 @@ DiskReader::seek (samplepos_t sample, bool complete_refill)
(*chan)->rbuf->reset ();
}
+ /* move the intended read target, so that after the refill is done,
+ the intended read target is "reservation" from the start of the
+ playback buffer. Then increment the read ptr, so that we can
+ potentially do an internal seek backwards of up "reservation"
+ samples.
+ */
+
+ const samplecnt_t shift = sample > c->front()->rbuf->reservation_size() ? c->front()->rbuf->reservation_size() : sample;
+
+ sample -= shift;
+
playback_sample = sample;
file_sample[DataType::AUDIO] = sample;
file_sample[DataType::MIDI] = sample;
@@ -792,6 +803,16 @@ DiskReader::seek (samplepos_t sample, bool complete_refill)
ret = do_refill_with_alloc (true);
}
+ sample += shift;
+
+ playback_sample = sample;
+ file_sample[DataType::AUDIO] = sample;
+ file_sample[DataType::MIDI] = sample;
+
+ for (n = 0, chan = c->begin(); chan != c->end(); ++chan, ++n) {
+ (*chan)->rbuf->increment_read_ptr (shift);
+ }
+
return ret;
}