Fixed re-setting the audio session category when closing an audio device
authorSam Lantinga <slouken@libsdl.org>
Fri, 14 Feb 2020 14:18:12 -0800
changeset 13521dfb34b6cbb7a
parent 13520 d62544e5fa7a
child 13522 3cd477fca37e
Fixed re-setting the audio session category when closing an audio device
src/audio/coreaudio/SDL_coreaudio.m
     1.1 --- a/src/audio/coreaudio/SDL_coreaudio.m	Fri Feb 14 13:37:32 2020 -0500
     1.2 +++ b/src/audio/coreaudio/SDL_coreaudio.m	Fri Feb 14 14:18:12 2020 -0800
     1.3 @@ -566,6 +566,12 @@
     1.4      AudioObjectRemovePropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this);
     1.5  #endif
     1.6  
     1.7 +    if (iscapture) {
     1.8 +        open_capture_devices--;
     1.9 +    } else {
    1.10 +        open_playback_devices--;
    1.11 +    }
    1.12 +
    1.13  #if !MACOSX_COREAUDIO
    1.14      update_audio_session(this, SDL_FALSE);
    1.15  #endif
    1.16 @@ -591,12 +597,6 @@
    1.17      SDL_free(this->hidden->thread_error);
    1.18      SDL_free(this->hidden->buffer);
    1.19      SDL_free(this->hidden);
    1.20 -
    1.21 -    if (iscapture) {
    1.22 -        open_capture_devices--;
    1.23 -    } else {
    1.24 -        open_playback_devices--;
    1.25 -    }
    1.26  }
    1.27  
    1.28  #if MACOSX_COREAUDIO