From 4b9a934ab469fd6dd0ff680b9a2f5047d309061b Mon Sep 17 00:00:00 2001 From: martynshaw99 Date: Thu, 15 Nov 2012 00:38:43 +0000 Subject: [PATCH] Set the 't' value to where we actually are in the stream, so that we calculate the right warpfactors, avoiding glitches. --- src/Mix.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Mix.cpp b/src/Mix.cpp index a387761ce..02d91950d 100644 --- a/src/Mix.cpp +++ b/src/Mix.cpp @@ -378,7 +378,7 @@ sampleCount Mixer::MixVariableRates(int *channelFlags, WaveTrack *track, double trackRate = track->GetRate(); double initialWarp = mRate / trackRate; double tstep = 1.0 / trackRate; - double t = *pos / trackRate; + double t = (*pos - *queueLen) / trackRate; int sampleSize = SAMPLE_SIZE(floatSample); sampleCount out = 0; @@ -580,8 +580,7 @@ sampleCount Mixer::Process(sampleCount maxToProcess) } } - if (mTimeTrack || - track->GetRate() != mRate) + if (mTimeTrack || track->GetRate() != mRate) out = MixVariableRates(channelFlags, track, &mSamplePos[i], mSampleQueue[i], &mQueueStart[i], &mQueueLen[i], mResample[i]);