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

Method Process

Source/MultitapDelay.cpp:74–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void MultitapDelay::Process(double time)
75{
76 PROFILER(MultitapDelay);
77
78 IAudioReceiver* target = GetTarget();
79
80 if (target == nullptr)
81 return;
82
83 SyncBuffers();
84
85 if (!mEnabled)
86 {
87 for (int ch = 0; ch < GetBuffer()->NumActiveChannels(); ++ch)
88 {
89 Add(target->GetBuffer()->GetChannel(ch), GetBuffer()->GetChannel(ch), GetBuffer()->BufferSize());
90 GetVizBuffer()->WriteChunk(GetBuffer()->GetChannel(ch), GetBuffer()->BufferSize(), ch);
91 }
92
93 GetBuffer()->Reset();
94 return;
95 }
96
97 mWriteBuffer.SetNumActiveChannels(GetBuffer()->NumActiveChannels());
98 mDelayBuffer.SetNumChannels(GetBuffer()->NumActiveChannels());
99 for (int t = 0; t < mNumTaps; ++t)
100 mTaps[t].mTapBuffer.SetNumActiveChannels(mWriteBuffer.NumActiveChannels());
101
102 int bufferSize = target->GetBuffer()->BufferSize();
103 assert(bufferSize == gBufferSize);
104
105 mWriteBuffer.Clear();
106
107 for (int ch = 0; ch < GetBuffer()->NumActiveChannels(); ++ch)
108 {
109 BufferCopy(mWriteBuffer.GetChannel(ch), GetBuffer()->GetChannel(ch), bufferSize);
110 Mult(mWriteBuffer.GetChannel(ch), mDryAmount, bufferSize);
111 mDelayBuffer.WriteChunk(GetBuffer()->GetChannel(ch), bufferSize, ch);
112 }
113
114 for (int i = 0; i < bufferSize; ++i)
115 {
116 ComputeSliders(i);
117
118 for (int ch = 0; ch < GetBuffer()->NumActiveChannels(); ++ch)
119 {
120 for (int t = 0; t < mNumTaps; ++t)
121 mTaps[t].Process(&mWriteBuffer.GetChannel(ch)[i], i, ch);
122 for (int t = 0; t < kNumMPETaps; ++t)
123 mMPETaps[t].Process(&mWriteBuffer.GetChannel(ch)[i], i, ch);
124 }
125 }
126
127 for (int ch = 0; ch < GetBuffer()->NumActiveChannels(); ++ch)
128 {
129 Add(target->GetBuffer()->GetChannel(ch), mWriteBuffer.GetChannel(ch), bufferSize);
130
131 GetVizBuffer()->WriteChunk(mWriteBuffer.GetChannel(ch), bufferSize, ch);

Callers

nothing calls this directly

Calls 15

AddFunction · 0.85
BufferCopyFunction · 0.85
MultFunction · 0.85
ofClampFunction · 0.85
GetLeftPanGainFunction · 0.85
GetRightPanGainFunction · 0.85
NumActiveChannelsMethod · 0.80
GetChannelMethod · 0.80
GetBufferMethod · 0.80
BufferSizeMethod · 0.80
WriteChunkMethod · 0.80
SetNumActiveChannelsMethod · 0.80

Tested by

no test coverage detected