MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / ProcessAudio

Method ProcessAudio

Source/TremoloEffect.cpp:67–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void TremoloEffect::ProcessAudio(double time, ChannelBuffer* buffer)
68{
69 PROFILER(TremoloEffect);
70
71 if (!mEnabled)
72 return;
73
74 float bufferSize = buffer->BufferSize();
75
76 ComputeSliders(0);
77
78 if (mAmount > 0)
79 {
80 for (int i = 0; i < bufferSize; ++i)
81 {
82 //smooth out LFO a bit to avoid pops with square/saw LFOs
83 mWindow[mWindowPos] = mLFO.Value(i + kAntiPopWindowSize / 2);
84 mWindowPos = (mWindowPos + 1) % kAntiPopWindowSize;
85 float lfoVal = 0;
86 for (int j = 0; j < kAntiPopWindowSize; ++j)
87 lfoVal += mWindow[j];
88 lfoVal /= kAntiPopWindowSize;
89
90 for (int ch = 0; ch < buffer->NumActiveChannels(); ++ch)
91 buffer->GetChannel(ch)[i] *= (1 - (mAmount * (1 - lfoVal)));
92 }
93 }
94}
95
96void TremoloEffect::DrawModule()
97{

Callers

nothing calls this directly

Calls 4

BufferSizeMethod · 0.80
NumActiveChannelsMethod · 0.80
GetChannelMethod · 0.80
ValueMethod · 0.45

Tested by

no test coverage detected