aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/mmdevapi.c
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-02-15 02:52:29 +0100
committerSven Gothel <[email protected]>2014-02-15 02:52:29 +0100
commit167b92184dfbe512d5095d017e6057280f5e9c8b (patch)
treec0957de971c402fd2b72887374a7c821ae40a219 /Alc/backends/mmdevapi.c
parent4b0fce521472bc30a539a252f83289dd1c32cb9e (diff)
parent29e0af5ef052a3602f9b7935d6002c6d2ae5e8cb (diff)
Merge branch 'UPSTREAM' into UPSTREAM_MERGE
Diffstat (limited to 'Alc/backends/mmdevapi.c')
-rw-r--r--Alc/backends/mmdevapi.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c
index fa7c54f9..b93ff667 100644
--- a/Alc/backends/mmdevapi.c
+++ b/Alc/backends/mmdevapi.c
@@ -600,6 +600,13 @@ static DWORD CALLBACK MMDevApiMsgProc(void *ptr)
CoUninitialize();
+ /* HACK: Force Windows to create a message queue for this thread before
+ * returning success, otherwise PostThreadMessage may fail if it gets
+ * called before GetMessage.
+ */
+ PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
+
+ TRACE("Message thread initialization complete\n");
req->result = S_OK;
SetEvent(req->FinishedEvt);
@@ -834,7 +841,10 @@ static ALCenum MMDevApiOpenPlayback(ALCdevice *device, const ALCchar *deviceName
data->NotifyEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
data->MsgEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
if(data->NotifyEvent == NULL || data->MsgEvent == NULL)
+ {
+ ERR("Failed to create message events: %lu\n", GetLastError());
hr = E_FAIL;
+ }
if(SUCCEEDED(hr))
{
@@ -859,6 +869,8 @@ static ALCenum MMDevApiOpenPlayback(ALCdevice *device, const ALCchar *deviceName
break;
}
}
+ if(FAILED(hr))
+ WARN("Failed to find device name matching \"%s\"\n", deviceName);
}
}
@@ -869,6 +881,8 @@ static ALCenum MMDevApiOpenPlayback(ALCdevice *device, const ALCchar *deviceName
hr = E_FAIL;
if(PostThreadMessage(ThreadID, WM_USER_OpenDevice, (WPARAM)&req, (LPARAM)device))
hr = WaitForResponse(&req);
+ else
+ ERR("Failed to post thread message: %lu\n", GetLastError());
}
if(FAILED(hr))