From 057ce335635ebf87e5507f7d78379eb36cc66ef1 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 20 Sep 2019 14:11:07 -0600 Subject: [PATCH] use internal seek to implement DiskReader::seek() when possible. This still needs a check that the amount of readable data left in the buffe is adequate. --- libs/ardour/disk_reader.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libs/ardour/disk_reader.cc b/libs/ardour/disk_reader.cc index 083704d3d7..35a6c6c00c 100644 --- a/libs/ardour/disk_reader.cc +++ b/libs/ardour/disk_reader.cc @@ -598,10 +598,13 @@ DiskReader::seek (samplepos_t sample, bool complete_refill) g_atomic_int_set (&_pending_overwrite, 0); - //sample = std::max ((samplecnt_t)0, sample -_session.worst_output_latency ()); + DEBUG_TRACE (DEBUG::DiskIO, string_compose ("DiskReader::seek %s %ld -> %ld refill=%d\n", owner()->name().c_str(), playback_sample, sample, complete_refill)); - //printf ("DiskReader::seek %s %ld -> %ld refill=%d\n", owner()->name().c_str(), playback_sample, sample, complete_refill); - // TODO: check if we can micro-locate + const samplecnt_t distance = sample - playback_sample; + if (can_internal_playback_seek (distance)) { + internal_playback_seek (distance); + return 0; + } for (n = 0, chan = c->begin(); chan != c->end(); ++chan, ++n) { (*chan)->rbuf->reset ();