changeset 3787:8d74a4721ca9 SDL-ryan-multiple-audio-device

Added deinitialize hook.
author Ryan C. Gordon <icculus@icculus.org>
date Tue, 03 Oct 2006 16:26:42 +0000
parents b70f4e9291bb
children 7006b176ef4f
files src/audio/SDL_audio.c src/audio/SDL_sysaudio.h src/audio/macosx/SDL_coreaudio.c
diffstat 3 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/audio/SDL_audio.c	Tue Oct 03 16:02:08 2006 +0000
+++ b/src/audio/SDL_audio.c	Tue Oct 03 16:26:42 2006 +0000
@@ -442,6 +442,7 @@
         current_audio.impl.LockAudio = SDL_LockAudio_Default;
         current_audio.impl.UnlockAudio = SDL_UnlockAudio_Default;
     }
+
     return (0);
 }
 
@@ -851,9 +852,9 @@
     for (i = 0; i < SDL_arraysize(open_devices); i++) {
         SDL_CloseAudioDevice(i);
     }
+
     /* Free the driver data */
-
-/* !!! FIXME!    current_audio.free(&current_audio); */
+    current_audio.Deinitialize();
     SDL_memset(&current_audio, '\0', sizeof (current_audio));
     SDL_memset(open_devices, '\0', sizeof (open_devices));
 }
--- a/src/audio/SDL_sysaudio.h	Tue Oct 03 16:02:08 2006 +0000
+++ b/src/audio/SDL_sysaudio.h	Tue Oct 03 16:26:42 2006 +0000
@@ -43,6 +43,7 @@
     void (*CloseAudio) (_THIS);
     void (*LockAudio) (_THIS);
     void (*UnlockAudio) (_THIS);
+    void (*Deinitialize) (void);
 } SDL_AudioDriverImpl;
 
 typedef struct SDL_AudioDriver
--- a/src/audio/macosx/SDL_coreaudio.c	Tue Oct 03 16:02:08 2006 +0000
+++ b/src/audio/macosx/SDL_coreaudio.c	Tue Oct 03 16:26:42 2006 +0000
@@ -179,6 +179,7 @@
 static void COREAUDIO_PlayAudio(_THIS);
 static Uint8 *COREAUDIO_GetAudioBuf(_THIS);
 static void COREAUDIO_CloseAudio(_THIS);
+static void COREAUDIO_Deinitialize(void);
 
 /* Audio driver bootstrap functions */
 
@@ -201,6 +202,7 @@
     impl->PlayAudio = COREAUDIO_PlayAudio;
     impl->GetAudioBuf = COREAUDIO_GetAudioBuf;
     impl->CloseAudio = COREAUDIO_CloseAudio;
+    impl->Deinitialize = COREAUDIO_Deinitialize;
 
     return 1;
 }
@@ -210,6 +212,15 @@
     COREAUDIO_Available, COREAUDIO_Init
 };
 
+
+static void
+COREAUDIO_Deinitialize(void)
+{
+    free_device_list(0, &outputDevices, &outputDeviceCount);
+    free_device_list(1, &inputDevices, &inputDeviceCount);
+}
+
+
 /* The CoreAudio callback */
 static OSStatus
 outputCallback(void *inRefCon,