src/audio/SDL_sysaudio.h
author Ryan C. Gordon
Tue, 03 Oct 2006 22:19:45 +0000
branchSDL-ryan-multiple-audio-device
changeset 3793 2b4795e92b62
parent 3792 866c310e2cb5
child 3795 589bc3d060cd
permissions -rw-r--r--
Removed a FIXME
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2006 Sam Lantinga
     4 
     5     This library is SDL_free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 #include "SDL_config.h"
    23 
    24 #ifndef _SDL_sysaudio_h
    25 #define _SDL_sysaudio_h
    26 
    27 #include "SDL_mutex.h"
    28 #include "SDL_thread.h"
    29 
    30 /* The SDL audio driver */
    31 typedef struct SDL_AudioDevice SDL_AudioDevice;
    32 #define _THIS	SDL_AudioDevice *_this
    33 
    34 typedef struct SDL_AudioDriverImpl
    35 {
    36     int (*DetectDevices)(int iscapture);
    37     const char *(*GetDeviceName)(int index, int iscapture);
    38     int (*OpenDevice) (_THIS, const char *devname, int iscapture);
    39     void (*ThreadInit) (_THIS); /* Called by audio thread at start */
    40     void (*WaitDevice) (_THIS);
    41     void (*PlayDevice) (_THIS);
    42     Uint8 *(*GetDeviceBuf) (_THIS);
    43     void (*WaitDone) (_THIS);
    44     void (*CloseDevice) (_THIS);
    45     void (*LockDevice) (_THIS);
    46     void (*UnlockDevice) (_THIS);
    47     void (*Deinitialize) (void);
    48 } SDL_AudioDriverImpl;
    49 
    50 typedef struct SDL_AudioDriver
    51 {
    52     /* * * */
    53     /* The name of this audio driver */
    54     const char *name;
    55 
    56     /* * * */
    57     /* The description of this audio driver */
    58     const char *desc;
    59 
    60     SDL_AudioDriverImpl impl;
    61 } SDL_AudioDriver;
    62 
    63 
    64 /* Define the SDL audio driver structure */
    65 struct SDL_AudioDevice
    66 {
    67     /* * * */
    68     /* Lowlevel audio implementation */
    69     const SDL_AudioDriver *driver;
    70 
    71     /* * * */
    72     /* Data common to all devices */
    73 
    74     /* The current audio specification (shared with audio thread) */
    75     SDL_AudioSpec spec;
    76 
    77     /* An audio conversion block for audio format emulation */
    78     SDL_AudioCVT convert;
    79 
    80     /* Current state flags */
    81     int enabled;
    82     int paused;
    83     int opened;
    84 
    85     /* Fake audio buffer for when the audio hardware is busy */
    86     Uint8 *fake_stream;
    87 
    88     /* A semaphore for locking the mixing buffers */
    89     SDL_mutex *mixer_lock;
    90 
    91     /* A thread to feed the audio device */
    92     SDL_Thread *thread;
    93     Uint32 threadid;
    94 
    95     /* * * */
    96     /* Data private to this driver */
    97     struct SDL_PrivateAudioData *hidden;
    98 
    99     /* * * */
   100     /* The function used to dispose of this structure */
   101     void (*free) (_THIS);
   102 };
   103 #undef _THIS
   104 
   105 typedef struct AudioBootStrap
   106 {
   107     const char *name;
   108     const char *desc;
   109     int (*available) (void);
   110     int (*init) (SDL_AudioDriverImpl *impl);
   111 } AudioBootStrap;
   112 
   113 #if SDL_AUDIO_DRIVER_BSD
   114 extern AudioBootStrap BSD_AUDIO_bootstrap;
   115 #endif
   116 #if SDL_AUDIO_DRIVER_OSS
   117 extern AudioBootStrap DSP_bootstrap;
   118 extern AudioBootStrap DMA_bootstrap;
   119 #endif
   120 #if SDL_AUDIO_DRIVER_ALSA
   121 extern AudioBootStrap ALSA_bootstrap;
   122 #endif
   123 #if SDL_AUDIO_DRIVER_QNXNTO
   124 extern AudioBootStrap QNXNTOAUDIO_bootstrap;
   125 #endif
   126 #if SDL_AUDIO_DRIVER_SUNAUDIO
   127 extern AudioBootStrap SUNAUDIO_bootstrap;
   128 #endif
   129 #if SDL_AUDIO_DRIVER_DMEDIA
   130 extern AudioBootStrap DMEDIA_bootstrap;
   131 #endif
   132 #if SDL_AUDIO_DRIVER_ARTS
   133 extern AudioBootStrap ARTS_bootstrap;
   134 #endif
   135 #if SDL_AUDIO_DRIVER_ESD
   136 extern AudioBootStrap ESD_bootstrap;
   137 #endif
   138 #if SDL_AUDIO_DRIVER_NAS
   139 extern AudioBootStrap NAS_bootstrap;
   140 #endif
   141 #if SDL_AUDIO_DRIVER_DSOUND
   142 extern AudioBootStrap DSOUND_bootstrap;
   143 #endif
   144 #if SDL_AUDIO_DRIVER_WAVEOUT
   145 extern AudioBootStrap WAVEOUT_bootstrap;
   146 #endif
   147 #if SDL_AUDIO_DRIVER_PAUD
   148 extern AudioBootStrap Paud_bootstrap;
   149 #endif
   150 #if SDL_AUDIO_DRIVER_BAUDIO
   151 extern AudioBootStrap BAUDIO_bootstrap;
   152 #endif
   153 #if SDL_AUDIO_DRIVER_COREAUDIO
   154 extern AudioBootStrap COREAUDIO_bootstrap;
   155 #endif
   156 #if SDL_AUDIO_DRIVER_SNDMGR
   157 extern AudioBootStrap SNDMGR_bootstrap;
   158 #endif
   159 #if SDL_AUDIO_DRIVER_AHI
   160 extern AudioBootStrap AHI_bootstrap;
   161 #endif
   162 #if SDL_AUDIO_DRIVER_MINT
   163 extern AudioBootStrap MINTAUDIO_GSXB_bootstrap;
   164 extern AudioBootStrap MINTAUDIO_MCSN_bootstrap;
   165 extern AudioBootStrap MINTAUDIO_STFA_bootstrap;
   166 extern AudioBootStrap MINTAUDIO_XBIOS_bootstrap;
   167 extern AudioBootStrap MINTAUDIO_DMA8_bootstrap;
   168 #endif
   169 #if SDL_AUDIO_DRIVER_DISK
   170 extern AudioBootStrap DISKAUD_bootstrap;
   171 #endif
   172 #if SDL_AUDIO_DRIVER_DUMMY
   173 extern AudioBootStrap DUMMYAUD_bootstrap;
   174 #endif
   175 #if SDL_AUDIO_DRIVER_DC
   176 extern AudioBootStrap DCAUD_bootstrap;
   177 #endif
   178 #if SDL_AUDIO_DRIVER_MMEAUDIO
   179 extern AudioBootStrap MMEAUDIO_bootstrap;
   180 #endif
   181 #if SDL_AUDIO_DRIVER_DART
   182 extern AudioBootStrap DART_bootstrap;
   183 #endif
   184 
   185 #endif /* _SDL_sysaudio_h */
   186 /* vi: set ts=4 sw=4 expandtab: */