From d251ce07e0cbbe8a85a4013fbfb15efa0f422b76 Mon Sep 17 00:00:00 2001 From: Exzap <13877693+Exzap@users.noreply.github.com> Date: Thu, 13 Oct 2022 12:18:34 +0200 Subject: [PATCH] XAudio2: Don't quit on failed CoInitializeEx() It returns an error code when already initialized --- src/audio/XAudio2API.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/audio/XAudio2API.cpp b/src/audio/XAudio2API.cpp index 795a0ebe..fd0a305b 100644 --- a/src/audio/XAudio2API.cpp +++ b/src/audio/XAudio2API.cpp @@ -187,7 +187,8 @@ const std::vector& XAudio2API::RefreshDevices( // this function must be called from the same thread as we called CoInitializeEx s_devices.clear(); - if (FAILED(CoInitializeEx(nullptr, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE))) + HRESULT r = CoInitializeEx(nullptr, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE); + if (r != RPC_E_CHANGED_MODE && FAILED(r)) return s_devices; try