MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / InitializeSound

Method InitializeSound

Source/SoundGen.cpp:356–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

354//// Sound buffer handling /////////////////////////////////////////////////////////////////////////////////
355
356bool CSoundGen::InitializeSound(HWND hWnd)
357{
358 // Initialize sound, this is only called once!
359 // Start with NTSC by default
360
361 // Called from main thread
362 ASSERT(GetCurrentThread() == FTEnv.GetMainApp()->m_hThread);
363 ASSERT(!m_pDSound);
364
365 m_bAutoDelete = FALSE; // // //
366
367 // Event used to interrupt the sound buffer synchronization
368 m_hInterruptEvent = ::CreateEventW(NULL, FALSE, FALSE, NULL);
369
370 // Create DirectSound object
371 m_pDSound = std::make_unique<CDSound>(hWnd, m_hInterruptEvent); // // //
372
373 // Out of memory
374 if (!m_pDSound)
375 return false;
376
377 m_pDSound->EnumerateDevices();
378
379 // Start thread when audio is done
380 ResumeThread();
381
382 return true;
383}
384
385void CSoundGen::Interrupt() const
386{

Callers 1

InitInstanceMethod · 0.80

Calls 2

GetMainAppMethod · 0.80
EnumerateDevicesMethod · 0.80

Tested by

no test coverage detected