00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00028 #ifndef _SDL_audio_h
00029 #define _SDL_audio_h
00030
00031 #include "SDL_stdinc.h"
00032 #include "SDL_error.h"
00033 #include "SDL_endian.h"
00034 #include "SDL_mutex.h"
00035 #include "SDL_thread.h"
00036 #include "SDL_rwops.h"
00037
00038 #include "begin_code.h"
00039
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043
00074 typedef struct SDL_AudioSpec {
00075 int freq;
00076 Uint16 format;
00077 Uint8 channels;
00078 Uint8 silence;
00079 Uint16 samples;
00080 Uint16 padding;
00081 Uint32 size;
00091 void (SDLCALL *callback)(void *userdata, Uint8 *stream, int len);
00092 void *userdata;
00093 } SDL_AudioSpec;
00094
00100 #define AUDIO_U8 0x0008
00101 #define AUDIO_S8 0x8008
00102 #define AUDIO_U16LSB 0x0010
00103 #define AUDIO_S16LSB 0x8010
00104 #define AUDIO_U16MSB 0x1010
00105 #define AUDIO_S16MSB 0x9010
00106 #define AUDIO_U16 AUDIO_U16LSB
00107 #define AUDIO_S16 AUDIO_S16LSB
00108
00113 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
00114 #define AUDIO_U16SYS AUDIO_U16LSB
00115 #define AUDIO_S16SYS AUDIO_S16LSB
00116 #else
00117 #define AUDIO_U16SYS AUDIO_U16MSB
00118 #define AUDIO_S16SYS AUDIO_S16MSB
00119 #endif
00120
00123
00124
00126 typedef struct SDL_AudioCVT {
00127 int needed;
00128 Uint16 src_format;
00129 Uint16 dst_format;
00130 double rate_incr;
00131 Uint8 *buf;
00132 int len;
00133 int len_cvt;
00134 int len_mult;
00135 double len_ratio;
00136 void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
00137 int filter_index;
00138 } SDL_AudioCVT;
00139
00140
00141
00142
00150 extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
00151 extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
00159 extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
00160
00178 extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
00179
00180 typedef enum {
00181 SDL_AUDIO_STOPPED = 0,
00182 SDL_AUDIO_PLAYING,
00183 SDL_AUDIO_PAUSED
00184 } SDL_audiostatus;
00185
00187 extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void);
00188
00196 extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
00197
00215 extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
00216
00218 #define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
00219 SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
00220
00224 extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf);
00225
00234 extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
00235 Uint16 src_format, Uint8 src_channels, int src_rate,
00236 Uint16 dst_format, Uint8 dst_channels, int dst_rate);
00237
00247 extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt);
00248
00249
00250 #define SDL_MIX_MAXVOLUME 128
00251
00258 extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume);
00259
00268 extern DECLSPEC void SDLCALL SDL_LockAudio(void);
00269 extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
00275 extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
00276
00277
00278
00279 #ifdef __cplusplus
00280 }
00281 #endif
00282 #include "close_code.h"
00283
00284 #endif