diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp index be6e704a7..ac998f062 100644 --- a/src/AudioIO.cpp +++ b/src/AudioIO.cpp @@ -1767,6 +1767,20 @@ int AudioIO::StartStream(WaveTrackArray playbackTracks, AILASetStartTime(); #endif + if (options.pStartTime) + { + // Calculate the new time position + mTime = std::max(mT0, std::min(mT1, *options.pStartTime)); + // Reset mixer positions for all playback tracks + unsigned numMixers = mPlaybackTracks.GetCount(); + for (unsigned ii = 0; ii < numMixers; ++ii) + mPlaybackMixers[ii]->Reposition(mTime); + if(mTimeTrack) + mWarpedTime = mTimeTrack->ComputeWarpedLength(mT0, mTime); + else + mWarpedTime = mTime - mT0; + } + #ifdef EXPERIMENTAL_SCRUBBING_SUPPORT delete mScrubQueue; if (scrubbing) diff --git a/src/AudioIO.h b/src/AudioIO.h index 7c99038b9..5f27aecc6 100644 --- a/src/AudioIO.h +++ b/src/AudioIO.h @@ -84,6 +84,7 @@ struct AudioIOStartStreamOptions , playLooped(false) , cutPreviewGapStart(0.0) , cutPreviewGapLen(0.0) + , pStartTime(NULL) #ifdef EXPERIMENTAL_SCRUBBING_SUPPORT , scrubDelay(0.0) , maxScrubSpeed(1.0) @@ -97,6 +98,7 @@ struct AudioIOStartStreamOptions bool playLooped; double cutPreviewGapStart; double cutPreviewGapLen; + double * pStartTime; #ifdef EXPERIMENTAL_SCRUBBING_SUPPORT // Positive value indicates that scrubbing will happen diff --git a/src/widgets/Ruler.cpp b/src/widgets/Ruler.cpp index da0ed019a..d860bcaa2 100644 --- a/src/widgets/Ruler.cpp +++ b/src/widgets/Ruler.cpp @@ -2043,7 +2043,7 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt) AudioIOStartStreamOptions options(mProject->GetDefaultPlayOptions()); options.playLooped = (loopEnabled && evt.ShiftDown()); - // options.pStartTime = &mPlayRegionStart; + options.pStartTime = &mPlayRegionStart; ctb->PlayPlayRegion((SelectedRegion(start, end)), options, evt.ControlDown(),