src/audio/SDL_sysaudio.h
author Sam Lantinga
Mon, 06 Feb 2006 08:28:51 +0000
changeset 1330 450721ad5436
parent 1312 c9b51268668f
child 1336 3692456e7b0f
permissions -rw-r--r--
It's now possible to build SDL without any C runtime at all on Windows,
using Visual C++ 2005
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2006 Sam Lantinga
     4 
     5     This library is 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 
    23 #ifndef _SDL_sysaudio_h
    24 #define _SDL_sysaudio_h
    25 
    26 #include "SDL_mutex.h"
    27 #include "SDL_thread.h"
    28 
    29 /* The SDL audio driver */
    30 typedef struct SDL_AudioDevice SDL_AudioDevice;
    31 
    32 /* Define the SDL audio driver structure */
    33 #define _THIS	SDL_AudioDevice *_this
    34 #ifndef _STATUS
    35 #define _STATUS	SDL_status *status
    36 #endif
    37 struct SDL_AudioDevice {
    38 	/* * * */
    39 	/* The name of this audio driver */
    40 	const char *name;
    41 
    42 	/* * * */
    43 	/* The description of this audio driver */
    44 	const char *desc;
    45 
    46 	/* * * */
    47 	/* Public driver functions */
    48 	int  (*OpenAudio)(_THIS, SDL_AudioSpec *spec);
    49 	void (*ThreadInit)(_THIS);	/* Called by audio thread at start */
    50 	void (*WaitAudio)(_THIS);
    51 	void (*PlayAudio)(_THIS);
    52 	Uint8 *(*GetAudioBuf)(_THIS);
    53 	void (*WaitDone)(_THIS);
    54 	void (*CloseAudio)(_THIS);
    55 
    56 	/* * * */
    57 	/* Lock / Unlock functions added for the Mac port */
    58 	void (*LockAudio)(_THIS);
    59 	void (*UnlockAudio)(_THIS);
    60 
    61 	/* * * */
    62 	/* Data common to all devices */
    63 
    64 	/* The current audio specification (shared with audio thread) */
    65 	SDL_AudioSpec spec;
    66 
    67 	/* An audio conversion block for audio format emulation */
    68 	SDL_AudioCVT convert;
    69 
    70 	/* Current state flags */
    71 	int enabled;
    72 	int paused;
    73 	int opened;
    74 
    75 	/* Fake audio buffer for when the audio hardware is busy */
    76 	Uint8 *fake_stream;
    77 
    78 	/* A semaphore for locking the mixing buffers */
    79 	SDL_mutex *mixer_lock;
    80 
    81 	/* A thread to feed the audio device */
    82 	SDL_Thread *thread;
    83 	Uint32 threadid;
    84 
    85 	/* * * */
    86 	/* Data private to this driver */
    87 	struct SDL_PrivateAudioData *hidden;
    88 
    89 	/* * * */
    90 	/* The function used to dispose of this structure */
    91 	void (*free)(_THIS);
    92 };
    93 #undef _THIS
    94 
    95 typedef struct AudioBootStrap {
    96 	const char *name;
    97 	const char *desc;
    98 	int (*available)(void);
    99 	SDL_AudioDevice *(*create)(int devindex);
   100 } AudioBootStrap;
   101 
   102 #ifdef OPENBSD_AUDIO_SUPPORT
   103 extern AudioBootStrap OPENBSD_AUDIO_bootstrap;
   104 #endif
   105 #ifdef OSS_SUPPORT
   106 extern AudioBootStrap DSP_bootstrap;
   107 extern AudioBootStrap DMA_bootstrap;
   108 #endif
   109 #ifdef ALSA_SUPPORT
   110 extern AudioBootStrap ALSA_bootstrap;
   111 #endif
   112 #ifdef QNXNTOAUDIO_SUPPORT
   113 extern AudioBootStrap QNXNTOAUDIO_bootstrap;
   114 #endif
   115 #ifdef SUNAUDIO_SUPPORT
   116 extern AudioBootStrap SUNAUDIO_bootstrap;
   117 #endif
   118 #ifdef DMEDIA_SUPPORT
   119 extern AudioBootStrap DMEDIA_bootstrap;
   120 #endif
   121 #ifdef ARTSC_SUPPORT
   122 extern AudioBootStrap ARTSC_bootstrap;
   123 #endif
   124 #ifdef ESD_SUPPORT
   125 extern AudioBootStrap ESD_bootstrap;
   126 #endif
   127 #ifdef NAS_SUPPORT
   128 extern AudioBootStrap NAS_bootstrap;
   129 #endif
   130 #ifdef ENABLE_DIRECTX
   131 extern AudioBootStrap DSOUND_bootstrap;
   132 #endif
   133 #ifdef ENABLE_WINDIB
   134 extern AudioBootStrap WAVEOUT_bootstrap;
   135 #endif
   136 #ifdef _AIX
   137 extern AudioBootStrap Paud_bootstrap;
   138 #endif
   139 #ifdef __BEOS__
   140 extern AudioBootStrap BAUDIO_bootstrap;
   141 #endif
   142 #ifdef MACOSX
   143 extern AudioBootStrap COREAUDIO_bootstrap;
   144 #endif
   145 #if defined(macintosh) || TARGET_API_MAC_CARBON
   146 extern AudioBootStrap SNDMGR_bootstrap;
   147 #endif
   148 #ifdef ENABLE_AHI
   149 extern AudioBootStrap AHI_bootstrap;
   150 #endif
   151 #ifdef MINTAUDIO_SUPPORT
   152 extern AudioBootStrap MINTAUDIO_GSXB_bootstrap;
   153 extern AudioBootStrap MINTAUDIO_MCSN_bootstrap;
   154 extern AudioBootStrap MINTAUDIO_STFA_bootstrap;
   155 extern AudioBootStrap MINTAUDIO_XBIOS_bootstrap;
   156 extern AudioBootStrap MINTAUDIO_DMA8_bootstrap;
   157 #endif
   158 #ifdef DISKAUD_SUPPORT
   159 extern AudioBootStrap DISKAUD_bootstrap;
   160 #endif
   161 #ifdef ENABLE_DC
   162 extern AudioBootStrap DCAUD_bootstrap;
   163 #endif
   164 #ifdef DRENDERER_SUPPORT
   165 extern AudioBootStrap DRENDERER_bootstrap;
   166 #endif
   167 #ifdef MMEAUDIO_SUPPORT
   168 extern AudioBootStrap MMEAUDIO_bootstrap;
   169 #endif
   170 #ifdef __OS2__
   171 extern AudioBootStrap DART_bootstrap;
   172 #endif
   173 
   174 /* This is the current audio device */
   175 extern SDL_AudioDevice *current_audio;
   176 
   177 #endif /* _SDL_sysaudio_h */