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

Method Process

libraries/lib-builtin-effects/ClickRemovalBase.cpp:87–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87bool 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 }
114done:
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
130bool ClickRemovalBase::ProcessOne(
131 int count, WaveChannel& track, sampleCount start, sampleCount len)

Callers

nothing calls this directly

Calls 10

maxFunction · 0.85
ProcessOneFunction · 0.85
ShowMessageBoxFunction · 0.85
TimeToLongSamplesMethod · 0.80
ChannelsMethod · 0.80
minFunction · 0.50
GetMethod · 0.45
GetStartTimeMethod · 0.45
GetEndTimeMethod · 0.45
CommitMethod · 0.45

Tested by

no test coverage detected