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

Method ApplyInner

src/commands/SetEnvelopeCommand.cpp:72–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72bool SetEnvelopeCommand::ApplyInner(const CommandContext &context, Track &t)
73{
74 // if no time is specified, then
75 // - delete deletes any envelope in selected tracks.
76 // - value is not set for any clip
77 t.TypeSwitch([&](WaveTrack &waveTrack) {
78 for (const auto pClip : waveTrack.SortedIntervalArray()) {
79 bool bFound =
80 !bHasT || (
81 (pClip->GetPlayStartTime() <= mT) &&
82 (pClip->GetPlayEndTime() >= mT)
83 );
84 if (bFound) {
85 // Inside this IF is where we actually apply the command
86 auto &env = pClip->GetEnvelope();
87 bool didSomething = false;
88 if (bHasDelete && mbDelete)
89 env.Clear(), didSomething = true;
90 if (bHasT && bHasV)
91 env.InsertOrReplace(mT, env.ClampValue(mV)),
92 didSomething = true;
93
94 if (didSomething)
95 // Consolidate, because this ApplyInner() function may be
96 // visited multiple times in one command invocation
97 ProjectHistory::Get(context.project).PushState(
98 XO("Edited Envelope"), XO("Envelope"),
99 UndoPush::CONSOLIDATE);
100 }
101 }
102 } );
103
104
105 return true;
106}
107
108namespace {
109using namespace MenuRegistry;

Callers

nothing calls this directly

Calls 6

GetFunction · 0.85
SortedIntervalArrayMethod · 0.80
GetPlayStartTimeMethod · 0.45
GetPlayEndTimeMethod · 0.45
ClearMethod · 0.45
PushStateMethod · 0.45

Tested by

no test coverage detected