aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/wasapi.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-06-02 19:50:03 -0700
committerChris Robinson <[email protected]>2023-06-02 19:50:03 -0700
commite7dafb65d73d2caf70a45776c5ffde9e38de4701 (patch)
treef695bef6308b82a6ff41d83195825963c16bcea6 /alc/backends/wasapi.cpp
parentcb7d5bc6d719c9114982e64c39caf2db7add9c58 (diff)
Fix UWP builds
Diffstat (limited to 'alc/backends/wasapi.cpp')
-rw-r--r--alc/backends/wasapi.cpp46
1 files changed, 20 insertions, 26 deletions
diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp
index 4e67f7dd..66400681 100644
--- a/alc/backends/wasapi.cpp
+++ b/alc/backends/wasapi.cpp
@@ -425,16 +425,29 @@ struct DeviceHelper final : private IMMNotificationClient
#endif
}
- static HRESULT ActivateAudioClient(_In_ DeviceHandle& device, void **ppv)
- {
#if !defined(ALSOFT_UWP)
- HRESULT hr{device->Activate(__uuidof(IAudioClient3), CLSCTX_INPROC_SERVER, nullptr, ppv)};
+ static HRESULT ActivateAudioClient(_In_ DeviceHandle& device, void **ppv)
+ { return device->Activate(__uuidof(IAudioClient3), CLSCTX_INPROC_SERVER, nullptr, ppv); }
#else
- HRESULT hr{ActivateAudioInterface(device.value->Id->Data(), __uuidof(IAudioClient3),
- nullptr, ppv)};
-#endif
- return hr;
+ HRESULT ActivateAudioClient(_In_ DeviceHandle& device, void **ppv)
+ {
+ ComPtr<IActivateAudioInterfaceAsyncOperation> asyncOp;
+ mPPV = ppv;
+ HRESULT hr{ActivateAudioInterfaceAsync(deviceInterfacePath, riid, activationParams, this,
+ al::out_ptr(asyncOp))};
+ if(FAILED(hr))
+ return hr;
+ asyncOp = nullptr;
+
+ DWORD res{WaitForSingleObjectEx(mActiveClientEvent, 2000, FALSE)};
+ if(res != WAIT_OBJECT_0)
+ {
+ ERR("WaitForSingleObjectEx error: 0x%lx\n", res);
+ return E_FAIL;
+ }
+ return S_OK;
}
+#endif
HRESULT probe_devices(EDataFlow flowdir, std::vector<DevMap>& list)
{
@@ -656,25 +669,6 @@ struct DeviceHelper final : private IMMNotificationClient
private:
#if defined(ALSOFT_UWP)
- HRESULT ActivateAudioInterface(_In_ LPCWSTR deviceInterfacePath,
- _In_ REFIID riid,
- _In_opt_ PROPVARIANT* activationParams,
- void** ppv)
- {
- IActivateAudioInterfaceAsyncOperation* asyncOp{nullptr};
- mPPV = ppv;
- HRESULT hr = ActivateAudioInterfaceAsync(deviceInterfacePath, riid, activationParams, this, &asyncOp);
- if(FAILED(hr))
- return hr;
- if(asyncOp)
- asyncOp->Release();
-
- DWORD res{WaitForSingleObjectEx(mActiveClientEvent, 2000, FALSE)};
- if(res != WAIT_OBJECT_0)
- ERR("WaitForSingleObjectEx error: 0x%lx\n", res);
- return res;
- }
-
HANDLE mActiveClientEvent{nullptr};
void** mPPV{nullptr};