From 922b3dc3e7bf599a889e9b7ca86687054641d4a8 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 14 Feb 2020 14:18:12 -0800 Subject: [PATCH] Fixed re-setting the audio session category when closing an audio device --- src/audio/coreaudio/SDL_coreaudio.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index bdca5e13bdc94..c20d9b0e6c418 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -566,6 +566,12 @@ static BOOL update_audio_session(_THIS, SDL_bool open) AudioObjectRemovePropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this); #endif + if (iscapture) { + open_capture_devices--; + } else { + open_playback_devices--; + } + #if !MACOSX_COREAUDIO update_audio_session(this, SDL_FALSE); #endif @@ -591,12 +597,6 @@ static BOOL update_audio_session(_THIS, SDL_bool open) SDL_free(this->hidden->thread_error); SDL_free(this->hidden->buffer); SDL_free(this->hidden); - - if (iscapture) { - open_capture_devices--; - } else { - open_playback_devices--; - } } #if MACOSX_COREAUDIO