# HG changeset patch # User Ryan C. Gordon # Date 1159892802 0 # Node ID 8d74a4721ca9993d3100b522e950ec3e51083732 # Parent b70f4e9291bb2e446a80a76b91a440313b0c5030 Added deinitialize hook. diff -r b70f4e9291bb -r 8d74a4721ca9 src/audio/SDL_audio.c --- 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(¤t_audio); */ + current_audio.Deinitialize(); SDL_memset(¤t_audio, '\0', sizeof (current_audio)); SDL_memset(open_devices, '\0', sizeof (open_devices)); } diff -r b70f4e9291bb -r 8d74a4721ca9 src/audio/SDL_sysaudio.h --- 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 diff -r b70f4e9291bb -r 8d74a4721ca9 src/audio/macosx/SDL_coreaudio.c --- 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,