From 7b92b235e10168f842d0809d8f0e30675694a44a Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 15 Aug 2017 16:25:46 -0400 Subject: [PATCH] Further upped `assert`s, thereby discovering the mistake I'd recently introduced: seeking properly within the event source as per its potential left-clipping, but then not allowing for that in the calculated current time. --- Storage/Disk/PCMPatchedTrack.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Storage/Disk/PCMPatchedTrack.cpp b/Storage/Disk/PCMPatchedTrack.cpp index cf3b9e3d0..d1cb9eed7 100644 --- a/Storage/Disk/PCMPatchedTrack.cpp +++ b/Storage/Disk/PCMPatchedTrack.cpp @@ -195,11 +195,14 @@ Storage::Time PCMPatchedTrack::seek_to(const Time &time_since_index_hole) { active_period_++; } - // allow whatever storage represents the period found to perform its seek + // allow whatever storage represents the period found to perform its seek; calculation for periods + // with an event source is, in effect: seek_to(offset_into_segment + distance_into_period) - offset_into_segment. if(active_period_->event_source) - current_time_ = active_period_->event_source->seek_to(active_period_->segment_start_time + time_since_index_hole - active_period_->start_time) + active_period_->start_time; + current_time_ = active_period_->event_source->seek_to(active_period_->segment_start_time + time_since_index_hole - active_period_->start_time) + active_period_->start_time - active_period_->segment_start_time; else current_time_ = underlying_track_->seek_to(time_since_index_hole); + + assert(current_time_ <= time_since_index_hole); return current_time_; }