1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-16 08:34:10 +02:00

Fix play from click position when Quick Play Loop in selection.

This commit is contained in:
Steve Daulton 2015-04-20 03:04:47 +00:00
parent 5e27710495
commit 79b7caac07
4 changed files with 20 additions and 1 deletions

View File

@ -1767,6 +1767,20 @@ int AudioIO::StartStream(WaveTrackArray playbackTracks,
AILASetStartTime(); AILASetStartTime();
#endif #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 #ifdef EXPERIMENTAL_SCRUBBING_SUPPORT
delete mScrubQueue; delete mScrubQueue;
if (scrubbing) if (scrubbing)

View File

@ -84,6 +84,7 @@ struct AudioIOStartStreamOptions
, playLooped(false) , playLooped(false)
, cutPreviewGapStart(0.0) , cutPreviewGapStart(0.0)
, cutPreviewGapLen(0.0) , cutPreviewGapLen(0.0)
, pStartTime(NULL)
#ifdef EXPERIMENTAL_SCRUBBING_SUPPORT #ifdef EXPERIMENTAL_SCRUBBING_SUPPORT
, scrubDelay(0.0) , scrubDelay(0.0)
, maxScrubSpeed(1.0) , maxScrubSpeed(1.0)
@ -97,6 +98,7 @@ struct AudioIOStartStreamOptions
bool playLooped; bool playLooped;
double cutPreviewGapStart; double cutPreviewGapStart;
double cutPreviewGapLen; double cutPreviewGapLen;
double * pStartTime;
#ifdef EXPERIMENTAL_SCRUBBING_SUPPORT #ifdef EXPERIMENTAL_SCRUBBING_SUPPORT
// Positive value indicates that scrubbing will happen // Positive value indicates that scrubbing will happen

View File

@ -482,6 +482,8 @@ int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion,
// to indicate backwards play. // to indicate backwards play.
const bool looped = options.playLooped; const bool looped = options.playLooped;
double startTime = *options.pStartTime;
if (backwards) if (backwards)
std::swap(t0, t1); std::swap(t0, t1);

View File

@ -2035,7 +2035,8 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
AudioIOStartStreamOptions options(mProject->GetDefaultPlayOptions()); AudioIOStartStreamOptions options(mProject->GetDefaultPlayOptions());
options.playLooped = (loopEnabled && evt.ShiftDown()); options.playLooped = (loopEnabled && evt.ShiftDown());
ctb->PlayPlayRegion((SelectedRegion(mPlayRegionStart, mPlayRegionEnd)), options.pStartTime = &mPlayRegionStart;
ctb->PlayPlayRegion((SelectedRegion(start, end)),
options, options,
evt.ControlDown(), evt.ControlDown(),
false, false,