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

Method lazyInitialize

src/core/AudioContext.cpp:212–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212void AudioContext::lazyInitialize()
213{
214 if (m_isInitialized)
215 return;
216
217 // Don't allow the context to initialize a second time after it's already been explicitly uninitialized.
218 ASSERT(!m_isAudioThreadFinished);
219 if (m_isAudioThreadFinished)
220 return;
221
222 if (m_device.get())
223 {
224 if (!isOfflineContext())
225 {
226 // This starts the audio thread and all audio rendering.
227 // The destination node's provideInput() method will now be called repeatedly to render audio.
228 // Each time provideInput() is called, a portion of the audio stream is rendered.
229
230 graphKeepAlive = 0.25f; // pump the graph for the first 0.25 seconds
231 graphUpdateThread = std::thread(&AudioContext::update, this);
232 device_callback->start();
233 }
234
235 cv.notify_all();
236 m_isInitialized = true;
237 }
238 else
239 {
240 LOG_ERROR("m_device not specified");
241 ASSERT(m_device);
242 }
243}
244
245void AudioContext::uninitialize()
246{

Callers 2

MakeRealtimeAudioContextFunction · 0.80
MakeOfflineAudioContextFunction · 0.80

Calls 2

getMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected