summaryrefslogtreecommitdiff
path: root/libs/ardour/disk_reader.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2020-04-01 07:54:44 -0600
committerPaul Davis <paul@linuxaudiosystems.com>2020-04-01 07:54:44 -0600
commit26c6d3c4c9d8d02aee3c58004b7b616b66630d22 (patch)
tree58500023f03d726bbde8a288b4a43146ce43105a /libs/ardour/disk_reader.cc
parent76070cb8c28f4068f5dcfc351ca7e885868dec4f (diff)
fix boolean logic PART FOUR when trying to avoid complete_refill heuristic
This reworking avoids some confusion caused by the use boost::optional here
Diffstat (limited to 'libs/ardour/disk_reader.cc')
-rw-r--r--libs/ardour/disk_reader.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/libs/ardour/disk_reader.cc b/libs/ardour/disk_reader.cc
index a744d2f898..38ce68cb66 100644
--- a/libs/ardour/disk_reader.cc
+++ b/libs/ardour/disk_reader.cc
@@ -762,12 +762,15 @@ DiskReader::seek (samplepos_t sample, bool complete_refill)
return 0;
}
- if ((!_last_read_reversed || (_last_read_reversed == read_reversed)) &&
- (!_last_read_loop || (_last_read_loop == read_loop))) {
+ /* There are two possible shortcuts we can take that will completely
+ * skip reading from disk. However, they are invalid if we need to read
+ * data in the opposite direction than we did last time, or if our need
+ * for looped data has chaned since the last read. Both of these change
+ * the semantics of a read from disk, even if the position we are
+ * reading from is the same.
+ */
- /* We do these things only if we're still reading in the same
- * direction we did last time.
- */
+ if ((_last_read_reversed.value_or (read_reversed) == read_reversed) && (_last_read_loop.value_or (read_loop) == read_loop)) {
if (sample == playback_sample && !complete_refill) {
return 0;