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

Method Process

Source/SeaOfGrain.cpp:105–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105void SeaOfGrain::Process(double time)
106{
107 PROFILER(SeaOfGrain);
108
109 IAudioReceiver* target = GetTarget();
110
111 if (target == nullptr || (mSample == nullptr && !mHasRecordedInput) || mLoading)
112 return;
113
114 if (!mEnabled)
115 {
116 SyncBuffers();
117
118 for (int ch = 0; ch < GetBuffer()->NumActiveChannels(); ++ch)
119 {
120 Add(target->GetBuffer()->GetChannel(ch), GetBuffer()->GetChannel(ch), GetBuffer()->BufferSize());
121 GetVizBuffer()->WriteChunk(GetBuffer()->GetChannel(ch), GetBuffer()->BufferSize(), ch);
122 }
123
124 GetBuffer()->Reset();
125 return;
126 }
127
128 ComputeSliders(0);
129 int numChannels = 2;
130 SyncBuffers(numChannels);
131 mRecordBuffer.SetNumChannels(numChannels);
132
133 int bufferSize = target->GetBuffer()->BufferSize();
134 ChannelBuffer* out = target->GetBuffer();
135 assert(bufferSize == gBufferSize);
136
137 if (mRecordInput)
138 {
139 for (int ch = 0; ch < numChannels; ++ch)
140 mRecordBuffer.WriteChunk(GetBuffer()->GetChannel(ch), bufferSize, ch);
141 }
142
143 gWorkChannelBuffer.SetNumActiveChannels(numChannels);
144 gWorkChannelBuffer.Clear();
145 for (int i = 0; i < kNumMPEVoices; ++i)
146 mMPEVoices[i].Process(&gWorkChannelBuffer, bufferSize);
147 for (int i = 0; i < kNumManualVoices; ++i)
148 mManualVoices[i].Process(&gWorkChannelBuffer, bufferSize);
149 for (int ch = 0; ch < numChannels; ++ch)
150 {
151 Mult(gWorkChannelBuffer.GetChannel(ch), mVolume, bufferSize);
152 GetVizBuffer()->WriteChunk(gWorkChannelBuffer.GetChannel(ch), bufferSize, ch);
153 Add(out->GetChannel(ch), gWorkChannelBuffer.GetChannel(ch), bufferSize);
154 }
155
156 GetBuffer()->Reset();
157}
158
159void SeaOfGrain::DrawModule()
160{

Callers

nothing calls this directly

Calls 15

AddFunction · 0.85
MultFunction · 0.85
ofMapFunction · 0.85
ClearFunction · 0.85
ofLerpFunction · 0.85
GetLeftPanGainFunction · 0.85
GetRightPanGainFunction · 0.85
NumActiveChannelsMethod · 0.80
GetChannelMethod · 0.80
GetBufferMethod · 0.80
BufferSizeMethod · 0.80
WriteChunkMethod · 0.80

Tested by

no test coverage detected