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

Function CheckFit

src/tracks/ui/TimeShiftHandle.cpp:658–689  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

656 std::unordered_map<Track*, TrackShifter::Intervals>;
657
658 bool CheckFit(
659 ClipMoveState &state, const Correspondence &correspondence,
660 const DetachedIntervals &intervals,
661 double tolerance, double &desiredSlideAmount )
662 {
663 bool ok = true;
664 double firstTolerance = tolerance;
665
666 // The desiredSlideAmount may change and the tolerance may get used up.
667 for ( unsigned iPass = 0; iPass < 2 && ok; ++iPass ) {
668 for ( auto &pair : state.shifters ) {
669 auto *pSrcTrack = pair.first;
670 auto iter = correspondence.find( pSrcTrack );
671 if ( iter != correspondence.end() )
672 if( auto *pOtherTrack = iter->second )
673 if ( !(ok = pair.second->AdjustFit(
674 *pOtherTrack, intervals.at(pSrcTrack),
675 desiredSlideAmount /*in,out*/, tolerance)) )
676 break;
677 }
678
679 // If it fits ok, desiredSlideAmount could have been updated to get
680 // the clip to fit.
681 // Check again, in the new position, this time with zero tolerance.
682 if (firstTolerance == 0)
683 break;
684 else
685 tolerance = 0.0;
686 }
687
688 return ok;
689 }
690
691 [[noreturn]] void MigrationFailure() {
692 // Tracks may be in an inconsistent state; throw to the application

Callers 1

DoSlideVerticalMethod · 0.85

Calls 3

findMethod · 0.45
endMethod · 0.45
AdjustFitMethod · 0.45

Tested by

no test coverage detected