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

Method GetPlaybackSlice

src/ProjectAudioManager.cpp:233–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231}
232
233PlaybackSlice CutPreviewPlaybackPolicy::GetPlaybackSlice(
234 PlaybackSchedule &, size_t available)
235{
236 size_t frames = available;
237 size_t toProduce = frames;
238 sampleCount samples1(mDuration1 * mRate + 0.5);
239 if (samples1 > 0 && samples1 < frames)
240 // Shorter slice than requested, up to the discontinuity
241 toProduce = frames = samples1.as_size_t();
242 else if (samples1 == 0) {
243 sampleCount samples2(mDuration2 * mRate + 0.5);
244 if (samples2 < frames) {
245 toProduce = samples2.as_size_t();
246 // Produce some extra silence so that the time queue consumer can
247 // satisfy its end condition
248 frames = std::min(available, toProduce + TimeQueueGrainSize + 1);
249 }
250 }
251 return { available, frames, toProduce };
252}
253
254std::pair<double, double> CutPreviewPlaybackPolicy::AdvancedTrackTime(
255 PlaybackSchedule &schedule, double trackTime, size_t nSamples)

Callers

nothing calls this directly

Calls 2

as_size_tMethod · 0.80
minFunction · 0.50

Tested by

no test coverage detected