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

Method Reinit

libraries/lib-snapping/Snap.cpp:76–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76void SnapManager::Reinit()
77{
78 const auto &formats = ProjectNumericFormats::Get(*mProject);
79 const auto &settings = ProjectSnap::Get( *mProject );
80
81 auto snapTo = settings.GetSnapTo();
82 auto snapMode = settings.GetSnapMode();
83
84 auto rate = ProjectRate::Get(*mProject).GetRate();
85 auto format = formats.GetSelectionFormat();
86
87 // No need to reinit if these are still the same
88 if (snapTo == mSnapTo && rate == mRate && format == mFormat)
89 {
90 return;
91 }
92
93 // Save NEW settings
94 mSnapTo = snapTo;
95 mRate = rate;
96 mFormat = format;
97
98 mSnapPoints.clear();
99
100 // Grab time-snapping prefs (unless otherwise requested)
101 mSnapToTime = snapMode != SnapMode::SNAP_OFF && !mNoTimeSnap;
102
103 // Add a SnapPoint at t=0
104 mSnapPoints.push_back(SnapPoint{});
105
106 // Adjust and filter the candidate points
107 for (const auto &candidate : mCandidates)
108 CondListAdd( candidate.t, candidate.track );
109
110 // Sort all by time
111 std::sort(mSnapPoints.begin(), mSnapPoints.end());
112}
113
114// Adds to mSnapPoints, filtering by TimeConverter
115void SnapManager::CondListAdd(double t, const Track *track)

Callers

nothing calls this directly

Calls 9

GetFunction · 0.85
GetSnapToMethod · 0.80
GetSnapModeMethod · 0.80
GetRateMethod · 0.45
GetSelectionFormatMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected