MCPcopy Create free account
hub / github.com/LabSound/LabSound / offlineRenderFrames

Method offlineRenderFrames

src/core/NullDeviceNode.cpp:180–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180void NullDeviceNode::offlineRenderFrames(size_t framesToProcess)
181{
182 ASSERT(framesToProcess % offlineRenderSizeQuantum == 0);
183
184 ASSERT(m_renderBus.get());
185 if (!m_renderBus.get())
186 return;
187
188 bool isRenderBusAllocated = m_renderBus->length() >= offlineRenderSizeQuantum;
189 ASSERT(isRenderBusAllocated);
190 if (!isRenderBusAllocated)
191 return;
192
193 bool isAudioContextInitialized = m_context->isInitialized();
194 ASSERT(isAudioContextInitialized);
195 if (!isAudioContextInitialized)
196 return;
197
198 //LOG_TRACE("offline render processing");
199
200 while (framesToProcess > 0 && !shouldExit)
201 {
202 m_context->update();
203 render(0, m_renderBus.get(), offlineRenderSizeQuantum, info);
204
205 // Update sampling info
206 const int index = 1 - (info.current_sample_frame & 1);
207 const uint64_t t = info.current_sample_frame & ~1;
208 info.current_sample_frame = t + offlineRenderSizeQuantum + index;
209 info.current_time = info.current_sample_frame / static_cast<double>(info.sampling_rate);
210 info.epoch[index] += std::chrono::nanoseconds {static_cast<uint64_t>(
211 1.e9 * (double)framesToProcess / (double)offlineRenderSizeQuantum) };
212
213 framesToProcess -= offlineRenderSizeQuantum;
214 }
215}

Callers 1

processMethod · 0.80

Calls 4

getMethod · 0.80
lengthMethod · 0.45
isInitializedMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected