From ca5e8792c826774d7769ab18de4bc5186134545f Mon Sep 17 00:00:00 2001 From: Nadia Holmquist Pedersen Date: Fri, 14 Jul 2023 02:10:04 +0200 Subject: [PATCH] Don't try to open the mic device every time if SDL says it has none Fixes the UI hanging up on Windows 11 when there are no mics, but the mic input is set to external device as it is by default. --- src/frontend/qt_sdl/AudioInOut.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/frontend/qt_sdl/AudioInOut.cpp b/src/frontend/qt_sdl/AudioInOut.cpp index 395dcf80..d44e92df 100644 --- a/src/frontend/qt_sdl/AudioInOut.cpp +++ b/src/frontend/qt_sdl/AudioInOut.cpp @@ -126,6 +126,10 @@ void MicOpen() return; } + int numMics = SDL_GetNumAudioDevices(1); + if (numMics == 0) + return; + SDL_AudioSpec whatIwant, whatIget; memset(&whatIwant, 0, sizeof(SDL_AudioSpec)); whatIwant.freq = 44100;