MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SoundThread

Function SoundThread

src/sound/win32_s.cpp:45–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45static 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
64std::optional<std::string_view> SoundDriver_Win32::Start(const StringList &parm)
65{

Callers

nothing calls this directly

Calls 2

MxMixSamplesFunction · 0.85
SetCurrentThreadNameFunction · 0.50

Tested by

no test coverage detected