From 607e60ab4d5e0bc161c11e5907bd7d70b1b17825 Mon Sep 17 00:00:00 2001 From: David Bailes Date: Fri, 13 Aug 2021 10:22:27 +0100 Subject: [PATCH] Time Shift left/right commands: can fail for stereo track. Time Shift left/right commands do not work on the right hand channel of a stereo track when clips are not aligned. This has been a problem since 3.3.0. Between 2.3.1 and 2.4.2 they moved a clip in the right hand channel more than they should, so moving the clip more than the cursor. Problems and fixes, both in DoClipMove(): 1. The reason for the commands not working at all was the track rather than the channel was been passed in the call MakeTrackShifter::Call( *channel, project ) 2. The reason for the clip being moved more than it should, was the left hand channel always being passed as the captured track in the call: state.Init( project, pShifter->GetTrack(), hitTestResult, std::move( uShifter ), t0, viewInfo, trackList, syncLocked ) (cherry picked from audacity commit 405847092231f2cf1ddaec25855daa2feeccc566) Signed-off-by: akleja --- src/menus/ClipMenus.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/menus/ClipMenus.cpp b/src/menus/ClipMenus.cpp index f9e221adf..9bd80103d 100644 --- a/src/menus/ClipMenus.cpp +++ b/src/menus/ClipMenus.cpp @@ -643,7 +643,7 @@ double DoClipMove( AudacityProject &project, Track *track, // Find the first channel that has a clip at time t0 auto hitTestResult = TrackShifter::HitTestResult::Track; for (auto channel : TrackList::Channels(track) ) { - uShifter = MakeTrackShifter::Call( *track, project ); + uShifter = MakeTrackShifter::Call( *channel, project ); if ( (hitTestResult = uShifter->HitTest( t0, viewInfo )) == TrackShifter::HitTestResult::Miss ) uShifter.reset(); @@ -657,7 +657,7 @@ double DoClipMove( AudacityProject &project, Track *track, auto desiredT0 = viewInfo.OffsetTimeByPixels( t0, ( right ? 1 : -1 ) ); auto desiredSlideAmount = pShifter->HintOffsetLarger( desiredT0 - t0 ); - state.Init( project, *track, hitTestResult, std::move( uShifter ), + state.Init( project, pShifter->GetTrack(), hitTestResult, std::move( uShifter ), t0, viewInfo, trackList, syncLocked ); auto hSlideAmount = state.DoSlideHorizontal( desiredSlideAmount );