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

Method Process

Source/SampleBrowser.cpp:162–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162void SampleBrowser::Process(double time)
163{
164 PROFILER(SampleBrowser);
165
166 IAudioReceiver* target = GetTarget();
167
168 if (!mEnabled || target == nullptr)
169 return;
170
171 int bufferSize = target->GetBuffer()->BufferSize();
172 assert(bufferSize == gBufferSize);
173
174 gWorkChannelBuffer.Clear();
175 mSampleMutex.lock();
176 if (mPlayingSample.IsPlaying())
177 mPlayingSample.ConsumeData(time, &gWorkChannelBuffer, bufferSize, true);
178 mSampleMutex.unlock();
179
180 const int kNumChannels = 2;
181 if (gWorkChannelBuffer.NumActiveChannels() == 1)
182 {
183 gWorkChannelBuffer.SetNumActiveChannels(2);
184 BufferCopy(gWorkChannelBuffer.GetChannel(1), gWorkChannelBuffer.GetChannel(0), bufferSize);
185 }
186 SyncOutputBuffer(kNumChannels);
187 for (int ch = 0; ch < kNumChannels; ++ch)
188 {
189 GetVizBuffer()->WriteChunk(gWorkChannelBuffer.GetChannel(ch), bufferSize, ch);
190 Add(target->GetBuffer()->GetChannel(ch), gWorkChannelBuffer.GetChannel(ch), bufferSize);
191 }
192}
193
194namespace
195{

Callers

nothing calls this directly

Calls 11

BufferCopyFunction · 0.85
AddFunction · 0.85
BufferSizeMethod · 0.80
GetBufferMethod · 0.80
IsPlayingMethod · 0.80
ConsumeDataMethod · 0.80
NumActiveChannelsMethod · 0.80
SetNumActiveChannelsMethod · 0.80
GetChannelMethod · 0.80
WriteChunkMethod · 0.80
ClearMethod · 0.45

Tested by

no test coverage detected