src/audio/SDL_sysaudio.h
changeset 0 74212992fb08
child 21 75a95f82bc1f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/audio/SDL_sysaudio.h	Thu Apr 26 16:45:43 2001 +0000
     1.3 @@ -0,0 +1,142 @@
     1.4 +/*
     1.5 +    SDL - Simple DirectMedia Layer
     1.6 +    Copyright (C) 1997, 1998, 1999, 2000, 2001  Sam Lantinga
     1.7 +
     1.8 +    This library is free software; you can redistribute it and/or
     1.9 +    modify it under the terms of the GNU Library General Public
    1.10 +    License as published by the Free Software Foundation; either
    1.11 +    version 2 of the License, or (at your option) any later version.
    1.12 +
    1.13 +    This library is distributed in the hope that it will be useful,
    1.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.16 +    Library General Public License for more details.
    1.17 +
    1.18 +    You should have received a copy of the GNU Library General Public
    1.19 +    License along with this library; if not, write to the Free
    1.20 +    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.21 +
    1.22 +    Sam Lantinga
    1.23 +    slouken@devolution.com
    1.24 +*/
    1.25 +
    1.26 +#ifdef SAVE_RCSID
    1.27 +static char rcsid =
    1.28 + "@(#) $Id$";
    1.29 +#endif
    1.30 +
    1.31 +#ifndef _SDL_sysaudio_h
    1.32 +#define _SDL_sysaudio_h
    1.33 +
    1.34 +#include "SDL_mutex.h"
    1.35 +#include "SDL_thread.h"
    1.36 +
    1.37 +/* The SDL audio driver */
    1.38 +typedef struct SDL_AudioDevice SDL_AudioDevice;
    1.39 +
    1.40 +/* Define the SDL audio driver structure */
    1.41 +#define _THIS	SDL_AudioDevice *_this
    1.42 +#ifndef _STATUS
    1.43 +#define _STATUS	SDL_status *status
    1.44 +#endif
    1.45 +struct SDL_AudioDevice {
    1.46 +	/* * * */
    1.47 +	/* The name of this audio driver */
    1.48 +	const char *name;
    1.49 +
    1.50 +	/* * * */
    1.51 +	/* The description of this audio driver */
    1.52 +	const char *desc;
    1.53 +
    1.54 +	/* * * */
    1.55 +	/* Public driver functions */
    1.56 +	int  (*OpenAudio)(_THIS, SDL_AudioSpec *spec);
    1.57 +	void (*ThreadInit)(_THIS);	/* Called by audio thread at start */
    1.58 +	void (*WaitAudio)(_THIS);
    1.59 +	void (*PlayAudio)(_THIS);
    1.60 +	Uint8 *(*GetAudioBuf)(_THIS);
    1.61 +	void (*WaitDone)(_THIS);
    1.62 +	void (*CloseAudio)(_THIS);
    1.63 +
    1.64 +	/* * * */
    1.65 +	/* Data common to all devices */
    1.66 +
    1.67 +	/* The current audio specification (shared with audio thread) */
    1.68 +	SDL_AudioSpec spec;
    1.69 +
    1.70 +	/* An audio conversion block for audio format emulation */
    1.71 +	SDL_AudioCVT convert;
    1.72 +
    1.73 +	/* Current state flags */
    1.74 +	int enabled;
    1.75 +	int paused;
    1.76 +	int opened;
    1.77 +
    1.78 +	/* Fake audio buffer for when the audio hardware is busy */
    1.79 +	Uint8 *fake_stream;
    1.80 +
    1.81 +	/* A semaphore for locking the mixing buffers */
    1.82 +	SDL_mutex *mixer_lock;
    1.83 +
    1.84 +	/* A thread to feed the audio device */
    1.85 +	SDL_Thread *thread;
    1.86 +	Uint32 threadid;
    1.87 +
    1.88 +	/* * * */
    1.89 +	/* Data private to this driver */
    1.90 +	struct SDL_PrivateAudioData *hidden;
    1.91 +
    1.92 +	/* * * */
    1.93 +	/* The function used to dispose of this structure */
    1.94 +	void (*free)(_THIS);
    1.95 +};
    1.96 +#undef _THIS
    1.97 +
    1.98 +typedef struct AudioBootStrap {
    1.99 +	const char *name;
   1.100 +	const char *desc;
   1.101 +	int (*available)(void);
   1.102 +	SDL_AudioDevice *(*create)(int devindex);
   1.103 +} AudioBootStrap;
   1.104 +
   1.105 +#if defined(unix) && \
   1.106 +   !defined(linux) && !defined(__FreeBSD__) && !defined(__CYGWIN32__) \
   1.107 +   && !defined(__bsdi__)
   1.108 +extern AudioBootStrap AUDIO_bootstrap;
   1.109 +#endif
   1.110 +#ifdef OSS_SUPPORT
   1.111 +extern AudioBootStrap DSP_bootstrap;
   1.112 +extern AudioBootStrap DMA_bootstrap;
   1.113 +#endif
   1.114 +#ifdef ALSA_SUPPORT
   1.115 +extern AudioBootStrap ALSA_bootstrap;
   1.116 +#endif
   1.117 +#ifdef ARTSC_SUPPORT
   1.118 +extern AudioBootStrap ARTSC_bootstrap;
   1.119 +#endif
   1.120 +#ifdef ESD_SUPPORT
   1.121 +extern AudioBootStrap ESD_bootstrap;
   1.122 +#endif
   1.123 +#ifdef NAS_SUPPORT
   1.124 +extern AudioBootStrap NAS_bootstrap;
   1.125 +#endif
   1.126 +#ifdef ENABLE_DIRECTX
   1.127 +extern AudioBootStrap DSOUND_bootstrap;
   1.128 +#endif
   1.129 +#ifdef ENABLE_WINDIB
   1.130 +extern AudioBootStrap WAVEOUT_bootstrap;
   1.131 +#endif
   1.132 +#ifdef __BEOS__
   1.133 +extern AudioBootStrap BAUDIO_bootstrap;
   1.134 +#endif
   1.135 +#if defined(macintosh) || TARGET_API_MAC_CARBON
   1.136 +extern AudioBootStrap SNDMGR_bootstrap;
   1.137 +#endif
   1.138 +#ifdef _AIX
   1.139 +extern AudioBootStrap Paud_bootstrap;
   1.140 +#endif
   1.141 +
   1.142 +/* This is the current audio device */
   1.143 +extern SDL_AudioDevice *current_audio;
   1.144 +
   1.145 +#endif /* _SDL_sysaudio_h */