| 43 | } |
| 44 | |
| 45 | static DWORD WINAPI SoundThread(LPVOID) |
| 46 | { |
| 47 | SetCurrentThreadName("ottd:win-sound"); |
| 48 | |
| 49 | do { |
| 50 | for (auto &hdr : _wave_hdr) { |
| 51 | if ((hdr.first.dwFlags & WHDR_INQUEUE) != 0) continue; |
| 52 | MxMixSamples(hdr.first.lpData, hdr.first.dwBufferLength / 4); |
| 53 | if (waveOutWrite(_waveout, &hdr.first, sizeof(WAVEHDR)) != MMSYSERR_NOERROR) { |
| 54 | MessageBox(nullptr, L"Sounds are disabled until restart.", L"waveOutWrite failed", MB_ICONINFORMATION); |
| 55 | return 0; |
| 56 | } |
| 57 | } |
| 58 | WaitForSingleObject(_event, INFINITE); |
| 59 | } while (_waveout != nullptr); |
| 60 | |
| 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | std::optional<std::string_view> SoundDriver_Win32::Start(const StringList &parm) |
| 65 | { |
nothing calls this directly
no test coverage detected