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/toolbars/ControlToolBar.cpp b/src/toolbars/ControlToolBar.cpp index af9f27d77..b105e9bed 100644 --- a/src/toolbars/ControlToolBar.cpp +++ b/src/toolbars/ControlToolBar.cpp @@ -482,6 +482,8 @@ int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion, // to indicate backwards play. const bool looped = options.playLooped; + double startTime = *options.pStartTime; + if (backwards) std::swap(t0, t1); diff --git a/src/widgets/Ruler.cpp b/src/widgets/Ruler.cpp index c9c15a4e6..c548efe7b 100644 --- a/src/widgets/Ruler.cpp +++ b/src/widgets/Ruler.cpp @@ -2035,7 +2035,8 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt) AudioIOStartStreamOptions options(mProject->GetDefaultPlayOptions()); options.playLooped = (loopEnabled && evt.ShiftDown()); - ctb->PlayPlayRegion((SelectedRegion(mPlayRegionStart, mPlayRegionEnd)), + options.pStartTime = &mPlayRegionStart; + ctb->PlayPlayRegion((SelectedRegion(start, end)), options, evt.ControlDown(), false,