MCPcopy Create free account
hub / github.com/audacity/audacity / SeekWhenAudioInactive

Function SeekWhenAudioInactive

src/menus/SelectMenus.cpp:268–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266}
267
268void SeekWhenAudioInactive
269(AudacityProject &project, double seekStep, TimeUnit timeUnit,
270SelectionOperation operation)
271{
272 auto &viewInfo = ViewInfo::Get(project);
273 auto &tracks = TrackList::Get(project);
274 const auto &settings = ProjectSnap::Get(project);
275 auto &viewport = Viewport::Get(project);
276
277 if (operation == CURSOR_MOVE)
278 {
279 MoveWhenAudioInactive( project, seekStep, timeUnit);
280 return;
281 }
282
283 auto snapMode = settings.GetSnapMode();
284 const double t0 = viewInfo.selectedRegion.t0();
285 const double t1 = viewInfo.selectedRegion.t1();
286 const double end = std::max(
287 tracks.GetEndTime(), viewInfo.GetScreenEndTime());
288
289 // Is it t0 or t1 moving?
290 bool bMoveT0 = (operation == SELECTION_CONTRACT && seekStep > 0) ||
291 (operation == SELECTION_EXTEND && seekStep < 0);
292 // newT is where we want to move to
293 double newT = OffsetTime( project,
294 bMoveT0 ? t0 : t1, seekStep, timeUnit, snapMode);
295 // constrain to be in the track/screen limits.
296 newT = std::max( 0.0, newT );
297 newT = std::min( newT, end);
298 // optionally constrain to be a contraction, i.e. so t0/t1 do not cross over
299 if( operation == SELECTION_CONTRACT )
300 newT = bMoveT0 ? std::min( t1, newT ) : std::max( t0, newT );
301
302 // Actually move
303 if( bMoveT0 )
304 viewInfo.selectedRegion.setT0( newT );
305 else
306 viewInfo.selectedRegion.setT1( newT );
307
308 // Ensure it is visible
309 viewport.ScrollIntoView(newT);
310}
311
312// Handle small cursor and play head movements
313void SeekLeftOrRight

Callers 1

SeekLeftOrRightFunction · 0.85

Calls 10

GetFunction · 0.85
MoveWhenAudioInactiveFunction · 0.85
maxFunction · 0.85
OffsetTimeFunction · 0.85
GetSnapModeMethod · 0.80
setT0Method · 0.80
setT1Method · 0.80
ScrollIntoViewMethod · 0.80
minFunction · 0.50
GetEndTimeMethod · 0.45

Tested by

no test coverage detected