| 85 | } |
| 86 | |
| 87 | bool ClickRemovalBase::Process(EffectInstance&, EffectSettings&) |
| 88 | { |
| 89 | EffectOutputTracks outputs { *mTracks, GetType(), { { mT0, mT1 } } }; |
| 90 | bool bGoodResult = true; |
| 91 | mbDidSomething = false; |
| 92 | |
| 93 | int count = 0; |
| 94 | for (auto track : outputs.Get().Selected<WaveTrack>()) |
| 95 | { |
| 96 | double trackStart = track->GetStartTime(); |
| 97 | double trackEnd = track->GetEndTime(); |
| 98 | double t0 = std::max(mT0, trackStart); |
| 99 | double t1 = std::min(trackEnd, mT1); |
| 100 | |
| 101 | if (t1 > t0) |
| 102 | { |
| 103 | auto start = track->TimeToLongSamples(t0); |
| 104 | auto end = track->TimeToLongSamples(t1); |
| 105 | auto len = end - start; |
| 106 | for (const auto pChannel : track->Channels()) |
| 107 | if (!ProcessOne(count++, *pChannel, start, len)) |
| 108 | { |
| 109 | bGoodResult = false; |
| 110 | goto done; |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | done: |
| 115 | if (bGoodResult && !mbDidSomething) // Processing successful, but |
| 116 | // ineffective. |
| 117 | { |
| 118 | using namespace BasicUI; |
| 119 | ShowMessageBox( |
| 120 | XO("Algorithm not effective on this audio. Nothing changed."), |
| 121 | MessageBoxOptions {}.IconStyle(Icon::Error)); |
| 122 | } |
| 123 | |
| 124 | if (bGoodResult && mbDidSomething) |
| 125 | outputs.Commit(); |
| 126 | |
| 127 | return bGoodResult && mbDidSomething; |
| 128 | } |
| 129 | |
| 130 | bool ClickRemovalBase::ProcessOne( |
| 131 | int count, WaveChannel& track, sampleCount start, sampleCount len) |
nothing calls this directly
no test coverage detected