SDL_sound  1.0.1
SDL_sound.h
Go to the documentation of this file.
1 
3 /*
4  * SDL_sound -- An abstract sound format decoding API.
5  * Copyright (C) 2001 Ryan C. Gordon.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */
21 
64 #ifndef _INCLUDE_SDL_SOUND_H_
65 #define _INCLUDE_SDL_SOUND_H_
66 
67 #include "SDL.h"
68 #include "SDL_endian.h"
69 
70 #ifdef __cplusplus
71 extern "C" {
72 #endif
73 
74 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
75 
76 #ifndef SDLCALL /* may not be defined with older SDL releases. */
77 #define SDLCALL
78 #endif
79 
80 #ifdef SDL_SOUND_DLL_EXPORTS
81 # define SNDDECLSPEC __declspec(dllexport)
82 #else
83 # define SNDDECLSPEC
84 #endif
85 
86 #define SOUND_VER_MAJOR 1
87 #define SOUND_VER_MINOR 0
88 #define SOUND_VER_PATCH 3
89 #endif
90 
91 
107 typedef enum
108 {
111  /* these are set at sample creation time... */
114  /* these are set during decoding... */
119 
120 
133 typedef struct
134 {
135  Uint16 format;
136  Uint8 channels;
137  Uint32 rate;
139 
140 
160 typedef struct
161 {
162  const char **extensions;
163  const char *description;
164  const char *author;
165  const char *url;
167 
168 
169 
179 typedef struct
180 {
181  void *opaque;
185  void *buffer;
186  Uint32 buffer_size;
188 } Sound_Sample;
189 
190 
204 typedef struct
205 {
206  int major;
207  int minor;
208  int patch;
209 } Sound_Version;
210 
211 
212 /* functions and macros... */
213 
230 #define SOUND_VERSION(x) \
231 { \
232  (x)->major = SOUND_VER_MAJOR; \
233  (x)->minor = SOUND_VER_MINOR; \
234  (x)->patch = SOUND_VER_PATCH; \
235 }
236 
237 
267 SNDDECLSPEC void SDLCALL Sound_GetLinkedVersion(Sound_Version *ver);
268 
269 
285 SNDDECLSPEC int SDLCALL Sound_Init(void);
286 
287 
310 SNDDECLSPEC int SDLCALL Sound_Quit(void);
311 
312 
345 SNDDECLSPEC const Sound_DecoderInfo ** SDLCALL Sound_AvailableDecoders(void);
346 
347 
363 SNDDECLSPEC const char * SDLCALL Sound_GetError(void);
364 
365 
374 SNDDECLSPEC void SDLCALL Sound_ClearError(void);
375 
376 
449 SNDDECLSPEC Sound_Sample * SDLCALL Sound_NewSample(SDL_RWops *rw,
450  const char *ext,
451  Sound_AudioInfo *desired,
452  Uint32 bufferSize);
453 
481 SNDDECLSPEC Sound_Sample * SDLCALL Sound_NewSampleFromFile(const char *fname,
482  Sound_AudioInfo *desired,
483  Uint32 bufferSize);
484 
499 SNDDECLSPEC void SDLCALL Sound_FreeSample(Sound_Sample *sample);
500 
501 
527 SNDDECLSPEC int SDLCALL Sound_SetBufferSize(Sound_Sample *sample,
528  Uint32 new_size);
529 
530 
550 SNDDECLSPEC Uint32 SDLCALL Sound_Decode(Sound_Sample *sample);
551 
552 
586 SNDDECLSPEC Uint32 SDLCALL Sound_DecodeAll(Sound_Sample *sample);
587 
588 
620 SNDDECLSPEC int SDLCALL Sound_Rewind(Sound_Sample *sample);
621 
622 
665 SNDDECLSPEC int SDLCALL Sound_Seek(Sound_Sample *sample, Uint32 ms);
666 
667 #ifdef __cplusplus
668 }
669 #endif
670 
671 #endif /* !defined _INCLUDE_SDL_SOUND_H_ */
672 
673 /* end of SDL_sound.h ... */
674