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

Method Silence

libraries/lib-wave-track/WaveTrack.cpp:2016–2036  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2014}
2015
2016void WaveTrack::Silence(double t0, double t1, ProgressReporter reportProgress)
2017{
2018 if (t1 < t0)
2019 THROW_INCONSISTENCY_EXCEPTION;
2020
2021 ApplyPitchAndSpeed({ { t0, t1 } }, std::move(reportProgress));
2022
2023 auto start = TimeToLongSamples(t0);
2024 auto end = TimeToLongSamples(t1);
2025
2026 for (const auto &pClip : Intervals()) {
2027 auto clipStart = pClip->GetPlayStartSample();
2028 auto clipEnd = pClip->GetPlayEndSample();
2029 if (clipEnd > start && clipStart < end) {
2030 auto offset = std::max(start - clipStart, sampleCount(0));
2031 // Clip sample region and Get/Put sample region overlap
2032 auto length = std::min(end, clipEnd) - (clipStart + offset);
2033 pClip->SetSilence(offset, length);
2034 }
2035 }
2036}
2037
2038/*! @excsafety{Strong} */
2039void WaveTrack::InsertSilence(double t, double len)

Callers 7

OnSplitCutLabelsFunction · 0.45
OnSplitDeleteLabelsFunction · 0.45
OnSilenceLabelsFunction · 0.45
OnSplitCutFunction · 0.45
OnSplitDeleteFunction · 0.45
OnSilenceFunction · 0.45
silenceTrackDataMethod · 0.45

Calls 8

moveFunction · 0.85
maxFunction · 0.85
GetPlayStartSampleMethod · 0.80
GetPlayEndSampleMethod · 0.80
IntervalsFunction · 0.70
sampleCountClass · 0.70
minFunction · 0.50
SetSilenceMethod · 0.45

Tested by

no test coverage detected