From b538ee5bd8bfb3eb21c491a35afb1de07f78b286 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 25 Dec 2016 21:32:50 -0500 Subject: [PATCH] Fixed discovery of correct active period and setting of track time, when seeking. --- Storage/Disk/PCMPatchedTrack.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Storage/Disk/PCMPatchedTrack.cpp b/Storage/Disk/PCMPatchedTrack.cpp index c25b00f3b..71ef0de86 100644 --- a/Storage/Disk/PCMPatchedTrack.cpp +++ b/Storage/Disk/PCMPatchedTrack.cpp @@ -196,15 +196,16 @@ Track::Event PCMPatchedTrack::get_next_event() Storage::Time PCMPatchedTrack::seek_to(const Time &time_since_index_hole) { - // start at the beginning and continue while segments start after the time sought + // start at the beginning and continue while segments end before reaching the time sought active_period_ = periods_.begin(); - while(active_period_->start_time > time_since_index_hole) active_period_++; + while(active_period_->end_time < time_since_index_hole) active_period_++; // allow whatever storage represents the period found to perform its seek if(active_period_->event_source) - return active_period_->event_source->seek_to(time_since_index_hole - active_period_->start_time) + active_period_->start_time; + current_time_ = active_period_->event_source->seek_to(time_since_index_hole - active_period_->start_time) + active_period_->start_time; else - return underlying_track_->seek_to(time_since_index_hole); + current_time_ = underlying_track_->seek_to(time_since_index_hole); + return current_time_; } void PCMPatchedTrack::Period::push_start_to_time(const Storage::Time &new_start_time)