Main Page   Data Structures   File List   Data Fields   Globals  

SDL_sound.h

Go to the documentation of this file.
00001 
00003 /*
00004  * SDL_sound -- An abstract sound format decoding API.
00005  * Copyright (C) 2001  Ryan C. Gordon.
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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  /* may not be defined with older SDL releases. */
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         /* these are set at sample creation time... */
00112     SOUND_SAMPLEFLAG_CANSEEK = 1,       
00114         /* these are set during decoding... */
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 /* functions and macros... */
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  /* !defined _INCLUDE_SDL_SOUND_H_ */
00672 
00673 /* end of SDL_sound.h ... */
00674 

Generated on Sun Oct 12 14:26:36 2003 for SDL_sound by doxygen1.2.16