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

Method Process

libraries/lib-builtin-effects/Reverse.cpp:55–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53// Effect implementation
54
55bool Reverse::Process(EffectInstance&, EffectSettings&)
56{
57 // all needed because Reverse should move the labels too
58 EffectOutputTracks outputs {
59 *mTracks, GetType(), { { mT0, mT1 } }, true, true
60 };
61 bool bGoodResult = true;
62 int count = 0;
63
64 auto trackRange =
65 outputs.Get().Any() + &SyncLock::IsSelectedOrSyncLockSelectedP;
66 trackRange.VisitWhile(
67 bGoodResult,
68 [&](WaveTrack& track) {
69 const auto progress = [&](double fraction) {
70 return !TrackProgress(count, fraction);
71 };
72 if (mT1 > mT0)
73 {
74 auto start = track.TimeToLongSamples(mT0);
75 auto end = track.TimeToLongSamples(mT1);
76 auto len = end - start;
77
78 if (!WaveTrackUtilities::Reverse(track, start, len, progress))
79 bGoodResult = false;
80 }
81 count += track.NChannels();
82 },
83 [&](LabelTrack& track) {
84 track.ChangeLabelsOnReverse(mT0, mT1);
85 count++;
86 });
87
88 if (bGoodResult)
89 outputs.Commit();
90
91 return bGoodResult;
92}

Callers

nothing calls this directly

Calls 8

ReverseClass · 0.85
VisitWhileMethod · 0.80
TimeToLongSamplesMethod · 0.80
ChangeLabelsOnReverseMethod · 0.80
AnyMethod · 0.45
GetMethod · 0.45
NChannelsMethod · 0.45
CommitMethod · 0.45

Tested by

no test coverage detected