00001
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00063 #ifndef _INCLUDE_SDL_SOUND_H_
00064 #define _INCLUDE_SDL_SOUND_H_
00065
00066 #include "SDL.h"
00067 #include "SDL_endian.h"
00068
00069 #ifdef __cplusplus
00070 extern "C" {
00071 #endif
00072
00073 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00074
00075 #ifndef SDLCALL
00076 #define SDLCALL
00077 #endif
00078
00079 #ifdef SDL_SOUND_DLL_EXPORTS
00080 # define SNDDECLSPEC __declspec(dllexport)
00081 #else
00082 # define SNDDECLSPEC
00083 #endif
00084
00085 #define SOUND_VER_MAJOR 1
00086 #define SOUND_VER_MINOR 0
00087 #define SOUND_VER_PATCH 0
00088 #endif
00089
00090
00106 typedef enum
00107 {
00108 SOUND_SAMPLEFLAG_NONE = 0,
00110
00111 SOUND_SAMPLEFLAG_CANSEEK = 1,
00113
00114 SOUND_SAMPLEFLAG_EOF = 1 << 29,
00115 SOUND_SAMPLEFLAG_ERROR = 1 << 30,
00116 SOUND_SAMPLEFLAG_EAGAIN = 1 << 31
00117 } Sound_SampleFlags;
00118
00119
00132 typedef struct
00133 {
00134 Uint16 format;
00135 Uint8 channels;
00136 Uint32 rate;
00137 } Sound_AudioInfo;
00138
00139
00159 typedef struct
00160 {
00161 const char **extensions;
00162 const char *description;
00163 const char *author;
00164 const char *url;
00165 } Sound_DecoderInfo;
00166
00167
00168
00178 typedef struct
00179 {
00180 void *opaque;
00181 const Sound_DecoderInfo *decoder;
00182 Sound_AudioInfo desired;
00183 Sound_AudioInfo actual;
00184 void *buffer;
00185 Uint32 buffer_size;
00186 Sound_SampleFlags flags;
00187 } Sound_Sample;
00188
00189
00203 typedef struct
00204 {
00205 int major;
00206 int minor;
00207 int patch;
00208 } Sound_Version;
00209
00210
00211
00212
00229 #define SOUND_VERSION(x) \
00230 { \
00231 (x)->major = SOUND_VER_MAJOR; \
00232 (x)->minor = SOUND_VER_MINOR; \
00233 (x)->patch = SOUND_VER_PATCH; \
00234 }
00235
00236
00266 SNDDECLSPEC void SDLCALL Sound_GetLinkedVersion(Sound_Version *ver);
00267
00268
00284 SNDDECLSPEC int SDLCALL Sound_Init(void);
00285
00286
00309 SNDDECLSPEC int SDLCALL Sound_Quit(void);
00310
00311
00344 SNDDECLSPEC const Sound_DecoderInfo ** SDLCALL Sound_AvailableDecoders(void);
00345
00346
00362 SNDDECLSPEC const char * SDLCALL Sound_GetError(void);
00363
00364
00373 SNDDECLSPEC void SDLCALL Sound_ClearError(void);
00374
00375
00448 SNDDECLSPEC Sound_Sample * SDLCALL Sound_NewSample(SDL_RWops *rw,
00449 const char *ext,
00450 Sound_AudioInfo *desired,
00451 Uint32 bufferSize);
00452
00480 SNDDECLSPEC Sound_Sample * SDLCALL Sound_NewSampleFromFile(const char *fname,
00481 Sound_AudioInfo *desired,
00482 Uint32 bufferSize);
00483
00498 SNDDECLSPEC void SDLCALL Sound_FreeSample(Sound_Sample *sample);
00499
00500
00526 SNDDECLSPEC int SDLCALL Sound_SetBufferSize(Sound_Sample *sample,
00527 Uint32 new_size);
00528
00529
00549 SNDDECLSPEC Uint32 SDLCALL Sound_Decode(Sound_Sample *sample);
00550
00551
00585 SNDDECLSPEC Uint32 SDLCALL Sound_DecodeAll(Sound_Sample *sample);
00586
00587
00619 SNDDECLSPEC int SDLCALL Sound_Rewind(Sound_Sample *sample);
00620
00621
00664 SNDDECLSPEC int SDLCALL Sound_Seek(Sound_Sample *sample, Uint32 ms);
00665
00666 #ifdef __cplusplus
00667 }
00668 #endif
00669
00670 #endif
00671
00672
00673