Added deinitialize hook. SDL-ryan-multiple-audio-device
authorRyan C. Gordon
Tue, 03 Oct 2006 16:26:42 +0000
branchSDL-ryan-multiple-audio-device
changeset 37878d74a4721ca9
parent 3786 b70f4e9291bb
child 3788 7006b176ef4f
Added deinitialize hook.
src/audio/SDL_audio.c
src/audio/SDL_sysaudio.h
src/audio/macosx/SDL_coreaudio.c
     1.1 --- a/src/audio/SDL_audio.c	Tue Oct 03 16:02:08 2006 +0000
     1.2 +++ b/src/audio/SDL_audio.c	Tue Oct 03 16:26:42 2006 +0000
     1.3 @@ -442,6 +442,7 @@
     1.4          current_audio.impl.LockAudio = SDL_LockAudio_Default;
     1.5          current_audio.impl.UnlockAudio = SDL_UnlockAudio_Default;
     1.6      }
     1.7 +
     1.8      return (0);
     1.9  }
    1.10  
    1.11 @@ -851,9 +852,9 @@
    1.12      for (i = 0; i < SDL_arraysize(open_devices); i++) {
    1.13          SDL_CloseAudioDevice(i);
    1.14      }
    1.15 +
    1.16      /* Free the driver data */
    1.17 -
    1.18 -/* !!! FIXME!    current_audio.free(&current_audio); */
    1.19 +    current_audio.Deinitialize();
    1.20      SDL_memset(&current_audio, '\0', sizeof (current_audio));
    1.21      SDL_memset(open_devices, '\0', sizeof (open_devices));
    1.22  }
     2.1 --- a/src/audio/SDL_sysaudio.h	Tue Oct 03 16:02:08 2006 +0000
     2.2 +++ b/src/audio/SDL_sysaudio.h	Tue Oct 03 16:26:42 2006 +0000
     2.3 @@ -43,6 +43,7 @@
     2.4      void (*CloseAudio) (_THIS);
     2.5      void (*LockAudio) (_THIS);
     2.6      void (*UnlockAudio) (_THIS);
     2.7 +    void (*Deinitialize) (void);
     2.8  } SDL_AudioDriverImpl;
     2.9  
    2.10  typedef struct SDL_AudioDriver
     3.1 --- a/src/audio/macosx/SDL_coreaudio.c	Tue Oct 03 16:02:08 2006 +0000
     3.2 +++ b/src/audio/macosx/SDL_coreaudio.c	Tue Oct 03 16:26:42 2006 +0000
     3.3 @@ -179,6 +179,7 @@
     3.4  static void COREAUDIO_PlayAudio(_THIS);
     3.5  static Uint8 *COREAUDIO_GetAudioBuf(_THIS);
     3.6  static void COREAUDIO_CloseAudio(_THIS);
     3.7 +static void COREAUDIO_Deinitialize(void);
     3.8  
     3.9  /* Audio driver bootstrap functions */
    3.10  
    3.11 @@ -201,6 +202,7 @@
    3.12      impl->PlayAudio = COREAUDIO_PlayAudio;
    3.13      impl->GetAudioBuf = COREAUDIO_GetAudioBuf;
    3.14      impl->CloseAudio = COREAUDIO_CloseAudio;
    3.15 +    impl->Deinitialize = COREAUDIO_Deinitialize;
    3.16  
    3.17      return 1;
    3.18  }
    3.19 @@ -210,6 +212,15 @@
    3.20      COREAUDIO_Available, COREAUDIO_Init
    3.21  };
    3.22  
    3.23 +
    3.24 +static void
    3.25 +COREAUDIO_Deinitialize(void)
    3.26 +{
    3.27 +    free_device_list(0, &outputDevices, &outputDeviceCount);
    3.28 +    free_device_list(1, &inputDevices, &inputDeviceCount);
    3.29 +}
    3.30 +
    3.31 +
    3.32  /* The CoreAudio callback */
    3.33  static OSStatus
    3.34  outputCallback(void *inRefCon,