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

Method offlineRender

src/core/NullDeviceNode.cpp:142–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142void NullDeviceNode::offlineRender()
143{
144 ASSERT(m_renderBus.get());
145 if (!m_renderBus.get())
146 return;
147
148 bool isRenderBusAllocated = m_renderBus->length() >= offlineRenderSizeQuantum;
149 ASSERT(isRenderBusAllocated);
150 if (!isRenderBusAllocated)
151 return;
152
153 bool isAudioContextInitialized = m_context->isInitialized();
154 ASSERT(isAudioContextInitialized);
155 if (!isAudioContextInitialized)
156 return;
157
158 // Break up the desired length into smaller "render quantum" sized pieces.
159 int framesToProcess = static_cast<int>((m_lengthSeconds * outConfig.desired_samplerate) / offlineRenderSizeQuantum);
160
161 LOG_TRACE("offline rendering started");
162
163 while (framesToProcess > 0 && !shouldExit)
164 {
165 m_context->update();
166 render(0, m_renderBus.get(), offlineRenderSizeQuantum, info);
167
168 // Update sampling info
169 const int index = 1 - (info.current_sample_frame & 1);
170 const uint64_t t = info.current_sample_frame & ~1;
171 info.current_sample_frame = t + offlineRenderSizeQuantum + index;
172 info.current_time = info.current_sample_frame / static_cast<double>(info.sampling_rate);
173 info.epoch[index] += std::chrono::nanoseconds {static_cast<uint64_t>(
174 1.e9 * (double) framesToProcess / (double) offlineRenderSizeQuantum)};
175
176 framesToProcess--;
177 }
178}
179
180void NullDeviceNode::offlineRenderFrames(size_t framesToProcess)
181{

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected