| 140 | } |
| 141 | |
| 142 | void 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 | |
| 180 | void NullDeviceNode::offlineRenderFrames(size_t framesToProcess) |
| 181 | { |
nothing calls this directly
no test coverage detected