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

Method Process

Source/LooperRecorder.cpp:152–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152void LooperRecorder::Process(double time)
153{
154 PROFILER(LooperRecorder);
155
156 IAudioReceiver* target = GetTarget();
157
158 if (target == nullptr)
159 return;
160
161 SyncBuffers();
162
163 if (!mEnabled)
164 {
165 for (int ch = 0; ch < GetBuffer()->NumActiveChannels(); ++ch)
166 {
167 Add(target->GetBuffer()->GetChannel(ch), GetBuffer()->GetChannel(ch), GetBuffer()->BufferSize());
168 GetVizBuffer()->WriteChunk(GetBuffer()->GetChannel(ch), GetBuffer()->BufferSize(), ch);
169 }
170
171 GetBuffer()->Reset();
172
173 return;
174 }
175
176 ComputeSliders(0);
177 mWriteBuffer.SetNumActiveChannels(GetBuffer()->NumActiveChannels());
178 mRecordBuffer.SetNumChannels(GetBuffer()->NumActiveChannels());
179
180 int bufferSize = GetBuffer()->BufferSize();
181
182 if (mCommitToLooper)
183 {
184 SyncLoopLengths();
185 mCommitToLooper->SetNumBars(mNumBars);
186 mCommitToLooper->Commit(&mRecordBuffer, false, mLatencyFixMs);
187
188 mRecorderMode = kRecorderMode_Record;
189 if (mTemporarilySilenceAfterCommit)
190 {
191 mQuietInputRamp.Start(time, 0, time + 10);
192 mUnquietInputTime = time + 1000; //no input for 1 second
193 }
194 mCommitToLooper = nullptr;
195 }
196
197 if (mUnquietInputTime != -1 && time >= mUnquietInputTime)
198 {
199 mQuietInputRamp.Start(time, 1, time + 10);
200 mUnquietInputTime = -1;
201 }
202
203 UpdateSpeed();
204
205 bool acceptInput = (mRecorderMode == kRecorderMode_Record || mRecorderMode == kRecorderMode_Overdub);
206 bool loop = (mRecorderMode == kRecorderMode_Loop || mRecorderMode == kRecorderMode_Overdub);
207
208
209 for (int i = 0; i < bufferSize; ++i)

Callers

nothing calls this directly

Calls 15

AddFunction · 0.85
NumActiveChannelsMethod · 0.80
GetChannelMethod · 0.80
GetBufferMethod · 0.80
BufferSizeMethod · 0.80
WriteChunkMethod · 0.80
SetNumActiveChannelsMethod · 0.80
SetNumChannelsMethod · 0.80
GetDurationMethod · 0.80
ResetMethod · 0.45
SetNumBarsMethod · 0.45
CommitMethod · 0.45

Tested by

no test coverage detected