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