diff options
author | Chris Robinson <[email protected]> | 2018-04-01 16:39:20 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-04-01 16:39:20 -0700 |
commit | 414b56edec5441211dc924fef365c54267c04f1c (patch) | |
tree | faf308d05cd1dfc2b84c2a5b1820a702b92272ba /Alc | |
parent | 334bc4f551af15281a9109200f5ffb34f22c67c1 (diff) |
Initialize COM using the multithreaded apartment
I honestly have no idea which is the correct (or better) mode to use given the
confusing mess COM is, but CoInitialize uses single-threaded apartments which
seems to be a problem for with at least a couple games in the STALKER series
(the call fails, which causes us to drop back to the DSound backend).
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/backends/wasapi.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Alc/backends/wasapi.c b/Alc/backends/wasapi.c index 8677afa9..50471f6b 100644 --- a/Alc/backends/wasapi.c +++ b/Alc/backends/wasapi.c @@ -388,7 +388,7 @@ static DWORD CALLBACK ALCwasapiProxy_messageHandler(void *ptr) TRACE("Starting message thread\n"); - cohr = CoInitialize(NULL); + cohr = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(FAILED(cohr)) { WARN("Failed to initialize COM: 0x%08lx\n", cohr); @@ -435,7 +435,7 @@ static DWORD CALLBACK ALCwasapiProxy_messageHandler(void *ptr) hr = cohr = S_OK; if(++deviceCount == 1) - hr = cohr = CoInitialize(NULL); + hr = cohr = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(SUCCEEDED(hr)) hr = V0(proxy,openProxy)(); if(FAILED(hr)) @@ -487,7 +487,7 @@ static DWORD CALLBACK ALCwasapiProxy_messageHandler(void *ptr) hr = cohr = S_OK; if(++deviceCount == 1) - hr = cohr = CoInitialize(NULL); + hr = cohr = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(SUCCEEDED(hr)) hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, &ptr); if(SUCCEEDED(hr)) @@ -627,10 +627,10 @@ FORCE_ALIGN static int ALCwasapiPlayback_mixerProc(void *arg) BYTE *buffer; HRESULT hr; - hr = CoInitialize(NULL); + hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(FAILED(hr)) { - ERR("CoInitialize(NULL) failed: 0x%08lx\n", hr); + ERR("CoInitializeEx(NULL, COINIT_MULTITHREADED) failed: 0x%08lx\n", hr); V0(device->Backend,lock)(); aluHandleDisconnect(device, "COM init failed: 0x%08lx", hr); V0(device->Backend,unlock)(); @@ -1321,10 +1321,10 @@ FORCE_ALIGN int ALCwasapiCapture_recordProc(void *arg) size_t samplesmax = 0; HRESULT hr; - hr = CoInitialize(NULL); + hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(FAILED(hr)) { - ERR("CoInitialize(NULL) failed: 0x%08lx\n", hr); + ERR("CoInitializeEx(NULL, COINIT_MULTITHREADED) failed: 0x%08lx\n", hr); V0(device->Backend,lock)(); aluHandleDisconnect(device, "COM init failed: 0x%08lx", hr); V0(device->Backend,unlock)(); |