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

Method Initialize

src/ProjectAudioManager.cpp:162–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160CutPreviewPlaybackPolicy::~CutPreviewPlaybackPolicy() = default;
161
162void CutPreviewPlaybackPolicy::Initialize(
163 PlaybackSchedule &schedule, double rate)
164{
165 PlaybackPolicy::Initialize(schedule, rate);
166
167 // Examine mT0 and mT1 in the schedule only now; ignore changes during play
168 double left = mStart = schedule.mT0;
169 double right = mEnd = schedule.mT1;
170 mReversed = left > right;
171 if (mReversed)
172 std::swap(left, right);
173
174 if (left < mGapLeft)
175 mDuration1 = schedule.ComputeWarpedLength(left, mGapLeft);
176 const auto gapEnd = mGapLeft + mGapLength;
177 if (gapEnd < right)
178 mDuration2 = schedule.ComputeWarpedLength(gapEnd, right);
179 if (mReversed)
180 std::swap(mDuration1, mDuration2);
181 if (sampleCount(mDuration2 * rate) == 0)
182 mDuration2 = mDuration1, mDuration1 = 0;
183 mInitDuration1 = mDuration1;
184 mInitDuration2 = mDuration2;
185}
186
187bool CutPreviewPlaybackPolicy::Done(PlaybackSchedule &schedule, unsigned long)
188{

Callers

nothing calls this directly

Calls 4

InitializeFunction · 0.70
swapFunction · 0.50
sampleCountClass · 0.50
ComputeWarpedLengthMethod · 0.45

Tested by

no test coverage detected