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

Method Process

Source/DrumPlayer.cpp:268–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266}
267
268void DrumPlayer::Process(double time)
269{
270 PROFILER(DrumPlayer);
271
272 if (!mEnabled)
273 return;
274
275 mNoteInputBuffer.Process(time);
276
277 int numChannels = mMonoOutput ? 1 : 2;
278
279 ComputeSliders(0);
280 SyncOutputBuffer(numChannels);
281 for (auto output : mIndividualOutputs)
282 output->mVizBuffer->SetNumChannels(numChannels);
283 mOutputBuffer.SetNumActiveChannels(numChannels);
284
285 int bufferSize = gBufferSize;
286
287 float volSq = mVolume * mVolume * .5f;
288
289 mOutputBuffer.Clear();
290
291 if (!mLoadingSamples)
292 {
293 mLoadSamplesAudioMutex.lock();
294 mLoadingSamples = true;
295 for (int i = 0; i < NUM_DRUM_HITS; ++i)
296 {
297 int individualOutputIndex = GetIndividualOutputIndex(i);
298 gWorkChannelBuffer.SetNumActiveChannels(numChannels);
299 if (mDrumHits[i].Process(time, mSpeed, volSq, &gWorkChannelBuffer, bufferSize))
300 {
301 for (int ch = 0; ch < numChannels; ++ch)
302 {
303 if (individualOutputIndex != -1)
304 {
305 int targetIndex = individualOutputIndex + 1;
306 IAudioReceiver* targetOut = GetTarget(targetIndex);
307 if (targetOut)
308 Add(targetOut->GetBuffer()->GetChannel(ch), gWorkChannelBuffer.GetChannel(ch), bufferSize);
309 mIndividualOutputs[individualOutputIndex]->mVizBuffer->WriteChunk(gWorkChannelBuffer.GetChannel(ch), bufferSize, ch);
310 }
311 else
312 {
313 Add(mOutputBuffer.GetChannel(ch), gWorkChannelBuffer.GetChannel(ch), bufferSize);
314 }
315 }
316 }
317 else
318 {
319 if (individualOutputIndex != -1)
320 {
321 for (int ch = 0; ch < numChannels; ++ch)
322 mIndividualOutputs[individualOutputIndex]->mVizBuffer->WriteChunk(gZeroBuffer, bufferSize, ch);
323 }
324 }
325 }

Callers

nothing calls this directly

Calls 15

AddFunction · 0.85
ofMapFunction · 0.85
GetInterpolatedSampleFunction · 0.85
SetNumChannelsMethod · 0.80
SetNumActiveChannelsMethod · 0.80
GetChannelMethod · 0.80
GetBufferMethod · 0.80
WriteChunkMethod · 0.80
DataMethod · 0.80
NumActiveChannelsMethod · 0.80
sizeMethod · 0.80
LengthInSamplesMethod · 0.80

Tested by

no test coverage detected