Browse Source

Fixed re-setting the audio session category when closing an audio device

Sam Lantinga 5 years ago
parent
commit
922b3dc3e7
1 changed files with 6 additions and 6 deletions
  1. 6 6
      src/audio/coreaudio/SDL_coreaudio.m

+ 6 - 6
src/audio/coreaudio/SDL_coreaudio.m

@@ -566,6 +566,12 @@ COREAUDIO_CloseDevice(_THIS)
     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 @@ COREAUDIO_CloseDevice(_THIS)
     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