| 354 | //// Sound buffer handling ///////////////////////////////////////////////////////////////////////////////// |
| 355 | |
| 356 | bool 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 | |
| 385 | void CSoundGen::Interrupt() const |
| 386 | { |
no test coverage detected