mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-12-13 22:37:02 +00:00
Windows: Fix file and folder dialog freeze (#369)
Initializing the COM library immediately seems to be more robust than doing it on demand
This commit is contained in:
parent
d251ce07e0
commit
a19ed46b2a
7 changed files with 7 additions and 47 deletions
|
|
@ -23,7 +23,6 @@ static const GUID DEVINTERFACE_AUDIO_RENDER_GUID = { 0xe6327cad, 0xdcec, 0x4949,
|
|||
static_assert(IAudioAPI::kBlockCount < XAUDIO2_MAX_QUEUED_BUFFERS, "too many xaudio2 buffers");
|
||||
|
||||
HMODULE XAudio2API::s_xaudio_dll = nullptr;
|
||||
bool XAudio2API::s_com_initialized = false;
|
||||
std::vector<XAudio2API::DeviceDescriptionPtr> XAudio2API::s_devices;
|
||||
|
||||
XAudio2API::XAudio2API(std::wstring device_id, uint32 samplerate, uint32 channels, uint32 samples_per_block, uint32 bits_per_sample)
|
||||
|
|
@ -143,8 +142,6 @@ bool XAudio2API::InitializeStatic()
|
|||
{
|
||||
if (s_xaudio_dll)
|
||||
return true;
|
||||
|
||||
s_com_initialized = (SUCCEEDED(CoInitializeEx(nullptr, COINIT_MULTITHREADED)));
|
||||
|
||||
// win 10
|
||||
s_xaudio_dll = LoadLibraryEx(XAUDIO2_DLL, nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||
|
|
@ -166,9 +163,6 @@ bool XAudio2API::InitializeStatic()
|
|||
if (s_xaudio_dll)
|
||||
FreeLibrary(s_xaudio_dll);
|
||||
|
||||
if (s_com_initialized)
|
||||
CoUninitialize();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -177,20 +171,12 @@ void XAudio2API::Destroy()
|
|||
{
|
||||
if (s_xaudio_dll)
|
||||
FreeLibrary(s_xaudio_dll);
|
||||
|
||||
if (s_com_initialized)
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
const std::vector<XAudio2API::DeviceDescriptionPtr>& XAudio2API::RefreshDevices()
|
||||
{
|
||||
// this function must be called from the same thread as we called CoInitializeEx
|
||||
s_devices.clear();
|
||||
|
||||
HRESULT r = CoInitializeEx(nullptr, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
|
||||
if (r != RPC_E_CHANGED_MODE && FAILED(r))
|
||||
return s_devices;
|
||||
|
||||
try
|
||||
{
|
||||
struct IWbemLocator *wbem_locator = nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue