| 178 | } |
| 179 | |
| 180 | void 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 | } |
no test coverage detected