From ef51cf4ee1822800a80bf7868230abbf6efed219 Mon Sep 17 00:00:00 2001 From: SimpleTease <31772993+SimpleTease@users.noreply.github.com> Date: Sun, 3 Jan 2021 04:33:49 +0000 Subject: [PATCH] Windows: Fix multiple XAudio instances --- audio/audio_thread_wrapper.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/audio/audio_thread_wrapper.c b/audio/audio_thread_wrapper.c index a412bb0da5..ba4c71b8f9 100644 --- a/audio/audio_thread_wrapper.c +++ b/audio/audio_thread_wrapper.c @@ -57,6 +57,10 @@ static void audio_thread_loop(void *data) if (!thr) return; +#if defined(_WIN32) + CoInitialize(NULL); +#endif + thr->driver_data = thr->driver->init( thr->device, thr->out_rate, thr->latency, thr->block_frames, thr->new_rate); @@ -166,6 +170,10 @@ static void audio_thread_free(void *data) if (thr->cond) scond_free(thr->cond); free(thr); + +#if defined(_WIN32) + CoUninitialize(NULL); +#endif } static bool audio_thread_alive(void *data)