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

Method Process

Source/KarplusStrong.cpp:92–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92void KarplusStrong::Process(double time)
93{
94 PROFILER(KarplusStrong);
95
96 IAudioReceiver* target = GetTarget();
97
98 if (!mEnabled || target == nullptr)
99 return;
100
101 SyncBuffers(mWriteBuffer.NumActiveChannels());
102
103 mNoteInputBuffer.Process(time);
104
105 ComputeSliders(0);
106
107 int bufferSize = target->GetBuffer()->BufferSize();
108 assert(bufferSize == gBufferSize);
109
110 mWriteBuffer.Clear();
111 mPolyMgr.Process(time, &mWriteBuffer, bufferSize);
112
113 for (int ch = 0; ch < mWriteBuffer.NumActiveChannels(); ++ch)
114 {
115 Mult(mWriteBuffer.GetChannel(ch), mVolume, bufferSize);
116 if (!mVoiceParams.mInvert) //unnecessary if inversion is eliminating dc offset
117 mDCRemover[ch].Filter(mWriteBuffer.GetChannel(ch), bufferSize);
118 }
119
120 mBiquad.ProcessAudio(time, &mWriteBuffer);
121
122 for (int ch = 0; ch < mWriteBuffer.NumActiveChannels(); ++ch)
123 {
124 GetVizBuffer()->WriteChunk(mWriteBuffer.GetChannel(ch), mWriteBuffer.BufferSize(), ch);
125 Add(target->GetBuffer()->GetChannel(ch), mWriteBuffer.GetChannel(ch), gBufferSize);
126 }
127
128 GetBuffer()->Reset();
129}
130
131void KarplusStrong::PlayNote(double time, int pitch, int velocity, int voiceIdx, ModulationParameters modulation)
132{

Callers

nothing calls this directly

Calls 11

MultFunction · 0.85
AddFunction · 0.85
NumActiveChannelsMethod · 0.80
BufferSizeMethod · 0.80
GetBufferMethod · 0.80
GetChannelMethod · 0.80
WriteChunkMethod · 0.80
FilterMethod · 0.60
ClearMethod · 0.45
ProcessAudioMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected