| 2014 | } |
| 2015 | |
| 2016 | void 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} */ |
| 2039 | void WaveTrack::InsertSilence(double t, double len) |
no test coverage detected