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

Method Process

Source/FollowingSong.cpp:65–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void FollowingSong::Process(double time)
66{
67 PROFILER(FollowingSong);
68
69 IAudioReceiver* target = GetTarget();
70
71 if (!mEnabled || target == nullptr)
72 return;
73
74 ComputeSliders(0);
75
76 int bufferSize = target->GetBuffer()->BufferSize();
77 float* out = target->GetBuffer()->GetChannel(0);
78 assert(bufferSize == gBufferSize);
79
80 float volSq = mVolume * mVolume * .5f;
81
82 if (!mLoadingSong && mPlay)
83 {
84 mLoadSongMutex.lock();
85
86 gWorkChannelBuffer.SetNumActiveChannels(1);
87 if (mSample.ConsumeData(time, &gWorkChannelBuffer, bufferSize, true))
88 {
89 for (int i = 0; i < bufferSize; ++i)
90 {
91 float sample = gWorkChannelBuffer.GetChannel(0)[i] * volSq;
92 if (mMute)
93 sample = 0;
94 out[i] += sample;
95 GetVizBuffer()->Write(sample, 0);
96 }
97 }
98 else
99 {
100 GetVizBuffer()->WriteChunk(gZeroBuffer, bufferSize, 0);
101 }
102 mLoadSongMutex.unlock();
103 }
104 else
105 {
106 GetVizBuffer()->WriteChunk(gZeroBuffer, bufferSize, 0);
107 }
108}
109
110void FollowingSong::DrawModule()
111{

Callers

nothing calls this directly

Calls 7

BufferSizeMethod · 0.80
GetBufferMethod · 0.80
GetChannelMethod · 0.80
SetNumActiveChannelsMethod · 0.80
ConsumeDataMethod · 0.80
WriteChunkMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected