src/audio/SDL_sysaudio.h
branchSDL-ryan-multiple-audio-device
changeset 3784 37c9c4590689
parent 1895 c121d94672cb
child 3787 8d74a4721ca9
     1.1 --- a/src/audio/SDL_sysaudio.h	Sun Oct 01 05:21:40 2006 +0000
     1.2 +++ b/src/audio/SDL_sysaudio.h	Sun Oct 01 05:24:03 2006 +0000
     1.3 @@ -29,13 +29,23 @@
     1.4  
     1.5  /* The SDL audio driver */
     1.6  typedef struct SDL_AudioDevice SDL_AudioDevice;
     1.7 +#define _THIS	SDL_AudioDevice *_this
     1.8  
     1.9 -/* Define the SDL audio driver structure */
    1.10 -#define _THIS	SDL_AudioDevice *_this
    1.11 -#ifndef _STATUS
    1.12 -#define _STATUS	SDL_status *status
    1.13 -#endif
    1.14 -struct SDL_AudioDevice
    1.15 +/* !!! FIXME: rename these from "Audio" to "Device" ... */
    1.16 +typedef struct SDL_AudioDriverImpl
    1.17 +{
    1.18 +    int (*OpenAudio) (_THIS, const char *devname, int iscapture);
    1.19 +    void (*ThreadInit) (_THIS); /* Called by audio thread at start */
    1.20 +    void (*WaitAudio) (_THIS);
    1.21 +    void (*PlayAudio) (_THIS);
    1.22 +    Uint8 *(*GetAudioBuf) (_THIS);
    1.23 +    void (*WaitDone) (_THIS);
    1.24 +    void (*CloseAudio) (_THIS);
    1.25 +    void (*LockAudio) (_THIS);
    1.26 +    void (*UnlockAudio) (_THIS);
    1.27 +} SDL_AudioDriverImpl;
    1.28 +
    1.29 +typedef struct SDL_AudioDriver
    1.30  {
    1.31      /* * * */
    1.32      /* The name of this audio driver */
    1.33 @@ -45,20 +55,16 @@
    1.34      /* The description of this audio driver */
    1.35      const char *desc;
    1.36  
    1.37 +    SDL_AudioDriverImpl impl;
    1.38 +} SDL_AudioDriver;
    1.39 +
    1.40 +
    1.41 +/* Define the SDL audio driver structure */
    1.42 +struct SDL_AudioDevice
    1.43 +{
    1.44      /* * * */
    1.45 -    /* Public driver functions */
    1.46 -    int (*OpenAudio) (_THIS, SDL_AudioSpec * spec);
    1.47 -    void (*ThreadInit) (_THIS); /* Called by audio thread at start */
    1.48 -    void (*WaitAudio) (_THIS);
    1.49 -    void (*PlayAudio) (_THIS);
    1.50 -    Uint8 *(*GetAudioBuf) (_THIS);
    1.51 -    void (*WaitDone) (_THIS);
    1.52 -    void (*CloseAudio) (_THIS);
    1.53 -
    1.54 -    /* * * */
    1.55 -    /* Lock / Unlock functions added for the Mac port */
    1.56 -    void (*LockAudio) (_THIS);
    1.57 -    void (*UnlockAudio) (_THIS);
    1.58 +    /* Lowlevel audio implementation */
    1.59 +    const SDL_AudioDriver *driver;
    1.60  
    1.61      /* * * */
    1.62      /* Data common to all devices */
    1.63 @@ -99,7 +105,7 @@
    1.64      const char *name;
    1.65      const char *desc;
    1.66      int (*available) (void);
    1.67 -    SDL_AudioDevice *(*create) (int devindex);
    1.68 +    int (*init) (SDL_AudioDriverImpl *impl);
    1.69  } AudioBootStrap;
    1.70  
    1.71  #if SDL_AUDIO_DRIVER_BSD
    1.72 @@ -174,8 +180,5 @@
    1.73  extern AudioBootStrap DART_bootstrap;
    1.74  #endif
    1.75  
    1.76 -/* This is the current audio device */
    1.77 -extern SDL_AudioDevice *current_audio;
    1.78 -
    1.79  #endif /* _SDL_sysaudio_h */
    1.80  /* vi: set ts=4 sw=4 expandtab: */