src/audio/SDL_sysaudio.h
author Ryan C. Gordon
Sun, 29 Oct 2006 04:08:50 +0000
branchSDL-1.2
changeset 3889 67d518069d9a
parent 1567 12b6d331d82a
child 3939 42e83d81224b
permissions -rw-r--r--
A few more AmigaOS things.
     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 
    33 /* Define the SDL audio driver structure */
    34 #define _THIS	SDL_AudioDevice *_this
    35 #ifndef _STATUS
    36 #define _STATUS	SDL_status *status
    37 #endif
    38 struct SDL_AudioDevice {
    39 	/* * * */
    40 	/* The name of this audio driver */
    41 	const char *name;
    42 
    43 	/* * * */
    44 	/* The description of this audio driver */
    45 	const char *desc;
    46 
    47 	/* * * */
    48 	/* Public driver functions */
    49 	int  (*OpenAudio)(_THIS, SDL_AudioSpec *spec);
    50 	void (*ThreadInit)(_THIS);	/* Called by audio thread at start */
    51 	void (*WaitAudio)(_THIS);
    52 	void (*PlayAudio)(_THIS);
    53 	Uint8 *(*GetAudioBuf)(_THIS);
    54 	void (*WaitDone)(_THIS);
    55 	void (*CloseAudio)(_THIS);
    56 
    57 	/* * * */
    58 	/* Lock / Unlock functions added for the Mac port */
    59 	void (*LockAudio)(_THIS);
    60 	void (*UnlockAudio)(_THIS);
    61 
    62 	/* * * */
    63 	/* Data common to all devices */
    64 
    65 	/* The current audio specification (shared with audio thread) */
    66 	SDL_AudioSpec spec;
    67 
    68 	/* An audio conversion block for audio format emulation */
    69 	SDL_AudioCVT convert;
    70 
    71 	/* Current state flags */
    72 	int enabled;
    73 	int paused;
    74 	int opened;
    75 
    76 	/* Fake audio buffer for when the audio hardware is busy */
    77 	Uint8 *fake_stream;
    78 
    79 	/* A semaphore for locking the mixing buffers */
    80 	SDL_mutex *mixer_lock;
    81 
    82 	/* A thread to feed the audio device */
    83 	SDL_Thread *thread;
    84 	Uint32 threadid;
    85 
    86 	/* * * */
    87 	/* Data private to this driver */
    88 	struct SDL_PrivateAudioData *hidden;
    89 
    90 	/* * * */
    91 	/* The function used to dispose of this structure */
    92 	void (*free)(_THIS);
    93 };
    94 #undef _THIS
    95 
    96 typedef struct AudioBootStrap {
    97 	const char *name;
    98 	const char *desc;
    99 	int (*available)(void);
   100 	SDL_AudioDevice *(*create)(int devindex);
   101 } AudioBootStrap;
   102 
   103 #if SDL_AUDIO_DRIVER_BSD
   104 extern AudioBootStrap BSD_AUDIO_bootstrap;
   105 #endif
   106 #if SDL_AUDIO_DRIVER_OSS
   107 extern AudioBootStrap DSP_bootstrap;
   108 extern AudioBootStrap DMA_bootstrap;
   109 #endif
   110 #if SDL_AUDIO_DRIVER_ALSA
   111 extern AudioBootStrap ALSA_bootstrap;
   112 #endif
   113 #if SDL_AUDIO_DRIVER_QNXNTO
   114 extern AudioBootStrap QNXNTOAUDIO_bootstrap;
   115 #endif
   116 #if SDL_AUDIO_DRIVER_SUNAUDIO
   117 extern AudioBootStrap SUNAUDIO_bootstrap;
   118 #endif
   119 #if SDL_AUDIO_DRIVER_DMEDIA
   120 extern AudioBootStrap DMEDIA_bootstrap;
   121 #endif
   122 #if SDL_AUDIO_DRIVER_ARTS
   123 extern AudioBootStrap ARTS_bootstrap;
   124 #endif
   125 #if SDL_AUDIO_DRIVER_ESD
   126 extern AudioBootStrap ESD_bootstrap;
   127 #endif
   128 #if SDL_AUDIO_DRIVER_NAS
   129 extern AudioBootStrap NAS_bootstrap;
   130 #endif
   131 #if SDL_AUDIO_DRIVER_DSOUND
   132 extern AudioBootStrap DSOUND_bootstrap;
   133 #endif
   134 #if SDL_AUDIO_DRIVER_WAVEOUT
   135 extern AudioBootStrap WAVEOUT_bootstrap;
   136 #endif
   137 #if SDL_AUDIO_DRIVER_PAUD
   138 extern AudioBootStrap Paud_bootstrap;
   139 #endif
   140 #if SDL_AUDIO_DRIVER_BAUDIO
   141 extern AudioBootStrap BAUDIO_bootstrap;
   142 #endif
   143 #if SDL_AUDIO_DRIVER_COREAUDIO
   144 extern AudioBootStrap COREAUDIO_bootstrap;
   145 #endif
   146 #if SDL_AUDIO_DRIVER_SNDMGR
   147 extern AudioBootStrap SNDMGR_bootstrap;
   148 #endif
   149 #if SDL_AUDIO_DRIVER_MINT
   150 extern AudioBootStrap MINTAUDIO_GSXB_bootstrap;
   151 extern AudioBootStrap MINTAUDIO_MCSN_bootstrap;
   152 extern AudioBootStrap MINTAUDIO_STFA_bootstrap;
   153 extern AudioBootStrap MINTAUDIO_XBIOS_bootstrap;
   154 extern AudioBootStrap MINTAUDIO_DMA8_bootstrap;
   155 #endif
   156 #if SDL_AUDIO_DRIVER_DISK
   157 extern AudioBootStrap DISKAUD_bootstrap;
   158 #endif
   159 #if SDL_AUDIO_DRIVER_DUMMY
   160 extern AudioBootStrap DUMMYAUD_bootstrap;
   161 #endif
   162 #if SDL_AUDIO_DRIVER_DC
   163 extern AudioBootStrap DCAUD_bootstrap;
   164 #endif
   165 #if SDL_AUDIO_DRIVER_MMEAUDIO
   166 extern AudioBootStrap MMEAUDIO_bootstrap;
   167 #endif
   168 #if SDL_AUDIO_DRIVER_DART
   169 extern AudioBootStrap DART_bootstrap;
   170 #endif
   171 
   172 /* This is the current audio device */
   173 extern SDL_AudioDevice *current_audio;
   174 
   175 #endif /* _SDL_sysaudio_h */