From af1b396c9e33352b453ff38403f22edc3eb570a1 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 28 Dec 2016 22:57:11 -0500 Subject: [PATCH] Found an ugly issue with `Storage::Time` as implemented (i) to be unsigned; and (ii) automatically to simplify. Will need to fix. Here's a quick workaround for this one segment of code. --- Storage/Disk/PCMPatchedTrack.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Storage/Disk/PCMPatchedTrack.cpp b/Storage/Disk/PCMPatchedTrack.cpp index a70ec9da9..4356912c5 100644 --- a/Storage/Disk/PCMPatchedTrack.cpp +++ b/Storage/Disk/PCMPatchedTrack.cpp @@ -155,13 +155,17 @@ Track::Event PCMPatchedTrack::get_next_event() // see what time that gets us to. If it's still within the current period, return the found event Time event_time = current_time_ + event.length - period_error - insertion_error_; - insertion_error_.set_zero(); if(event_time < active_period_->end_time) { current_time_ = event_time; - event.length += extra_time - period_error; + // TODO: this is spelt out in three steps because times don't necessarily do the sensible + // thing when 'negative' if intermediate result get simplified in the meantime. So fix Time. + event.length += extra_time; + event.length -= period_error; + event.length -= insertion_error_; return event; } + insertion_error_.set_zero(); // otherwise move time back to the end of the outgoing period, accumulating the error into // extra_time, and advance the extra period