123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- #ifndef _SDL_audio_h
- #define _SDL_audio_h
- #include "SDL_stdinc.h"
- #include "SDL_error.h"
- #include "SDL_endian.h"
- #include "SDL_mutex.h"
- #include "SDL_thread.h"
- #include "SDL_rwops.h"
- #include "begin_code.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- typedef struct SDL_AudioSpec {
- int freq;
- Uint16 format;
- Uint8 channels;
- Uint8 silence;
- Uint16 samples;
- Uint16 padding;
- Uint32 size;
-
- void (SDLCALL *callback)(void *userdata, Uint8 *stream, int len);
- void *userdata;
- } SDL_AudioSpec;
- #define AUDIO_U8 0x0008
- #define AUDIO_S8 0x8008
- #define AUDIO_U16LSB 0x0010
- #define AUDIO_S16LSB 0x8010
- #define AUDIO_U16MSB 0x1010
- #define AUDIO_S16MSB 0x9010
- #define AUDIO_U16 AUDIO_U16LSB
- #define AUDIO_S16 AUDIO_S16LSB
- #if SDL_BYTEORDER == SDL_LIL_ENDIAN
- #define AUDIO_U16SYS AUDIO_U16LSB
- #define AUDIO_S16SYS AUDIO_S16LSB
- #else
- #define AUDIO_U16SYS AUDIO_U16MSB
- #define AUDIO_S16SYS AUDIO_S16MSB
- #endif
- typedef struct SDL_AudioCVT {
- int needed;
- Uint16 src_format;
- Uint16 dst_format;
- double rate_incr;
- Uint8 *buf;
- int len;
- int len_cvt;
- int len_mult;
- double len_ratio;
- void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
- int filter_index;
- } SDL_AudioCVT;
- extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
- extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
- extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
- extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
- typedef enum {
- SDL_AUDIO_STOPPED = 0,
- SDL_AUDIO_PLAYING,
- SDL_AUDIO_PAUSED
- } SDL_audiostatus;
- extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void);
- extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
- extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
- #define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
- SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
- extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf);
- extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
- Uint16 src_format, Uint8 src_channels, int src_rate,
- Uint16 dst_format, Uint8 dst_channels, int dst_rate);
- extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt);
- #define SDL_MIX_MAXVOLUME 128
- extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume);
- extern DECLSPEC void SDLCALL SDL_LockAudio(void);
- extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
- extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
- #ifdef __cplusplus
- }
- #endif
- #include "close_code.h"
- #endif
|