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

Function SeekLeftOrRight

src/menus/SelectMenus.cpp:313–348  ·  view source on GitHub ↗

Handle small cursor and play head movements

Source from the content-addressed store, hash-verified

311
312// Handle small cursor and play head movements
313void SeekLeftOrRight
314(AudacityProject &project, double direction, SelectionOperation operation,
315 SeekInfo &info)
316{
317 // PRL: What I found and preserved, strange though it be:
318 // During playback: jump depends on preferences and is independent of the
319 // zoom and does not vary if the key is held
320 // Else: jump depends on the zoom and gets bigger if the key is held
321
322 if( ProjectAudioIO::Get( project ).IsAudioActive() )
323 {
324 if( operation == CURSOR_MOVE )
325 SeekWhenAudioActive( info.mSeekShort * direction,
326 info.mLastSelectionAdjustment );
327 else if( operation == SELECTION_EXTEND )
328 SeekWhenAudioActive( info.mSeekLong * direction,
329 info.mLastSelectionAdjustment );
330 // Note: no action for CURSOR_CONTRACT
331 return;
332 }
333
334 // If the last adjustment was very recent, we are
335 // holding the key down and should move faster.
336 const wxLongLong curtime = ::wxGetUTCTimeMillis();
337 enum { MIN_INTERVAL = 50 };
338 const bool fast =
339 (curtime - info.mLastSelectionAdjustment < MIN_INTERVAL);
340
341 info.mLastSelectionAdjustment = curtime;
342
343 // How much faster should the cursor move if shift is down?
344 enum { LARGER_MULTIPLIER = 4 };
345 const double seekStep = (fast ? LARGER_MULTIPLIER : 1.0) * direction;
346
347 SeekWhenAudioInactive( project, seekStep, TIME_UNIT_PIXELS, operation);
348}
349
350// Move the cursor forward or backward, while paused or while playing.
351void DoCursorMove(

Callers 10

OnSelExtendLeftMethod · 0.85
OnSelExtendRightMethod · 0.85
OnSelContractLeftMethod · 0.85
OnSelContractRightMethod · 0.85
OnCursorLeftMethod · 0.85
OnCursorRightMethod · 0.85
OnSeekLeftShortMethod · 0.85
OnSeekRightShortMethod · 0.85
OnSeekLeftLongMethod · 0.85
OnSeekRightLongMethod · 0.85

Calls 4

GetFunction · 0.85
SeekWhenAudioActiveFunction · 0.85
SeekWhenAudioInactiveFunction · 0.85
IsAudioActiveMethod · 0.45

Tested by

no test coverage detected