SDL_sound unknown version (build with 'make docs' next time!)
SDL_sound.h
1/*
2 * SDL_sound; An abstract sound format decoding API.
3 *
4 * Please see the file LICENSE.txt in the source's root directory.
5 */
6
7/* WIKI CATEGORY: SDLSound */
8
47
48#ifndef SDL_SOUND_H_
49#define SDL_SOUND_H_
50
51#include <SDL3/SDL.h>
52
53#if SDL_MAJOR_VERSION < 3
54#error SDL3_sound requires SDL 3.0.0 or later.
55#endif
56
57#ifdef __cplusplus
58extern "C" {
59#endif
60
68#define SDL_SOUND_MAJOR_VERSION 3
69
77#define SDL_SOUND_MINOR_VERSION 0
78
86#define SDL_SOUND_MICRO_VERSION 0
87
95#define SDL_SOUND_VERSION \
96 SDL_VERSIONNUM(SDL_SOUND_MAJOR_VERSION, SDL_SOUND_MINOR_VERSION, SDL_SOUND_MICRO_VERSION)
97
103#define SDL_SOUND_VERSION_ATLEAST(X, Y, Z) \
104 ((SDL_SOUND_MAJOR_VERSION >= X) && \
105 (SDL_SOUND_MAJOR_VERSION > X || SDL_SOUND_MINOR_VERSION >= Y) && \
106 (SDL_SOUND_MAJOR_VERSION > X || SDL_SOUND_MINOR_VERSION > Y || SDL_SOUND_MICRO_VERSION >= Z))
107
108
118extern SDL_DECLSPEC int SDLCALL Sound_Version(void);
119
120
132typedef enum Sound_SampleFlags
133{
134 SOUND_SAMPLEFLAG_NONE = 0,
135
136 /* these are set at sample creation time... */
137 SOUND_SAMPLEFLAG_CANSEEK = 1,
138
139 /* these are set during decoding... */
140 SOUND_SAMPLEFLAG_EOF = 1 << 29,
141 SOUND_SAMPLEFLAG_ERROR = 1 << 30,
142 SOUND_SAMPLEFLAG_EAGAIN = 1 << 31
143} Sound_SampleFlags;
144
145
165typedef struct Sound_DecoderInfo
166{
167 const char **extensions;
168 const char *description;
169 const char *author;
170 const char *url;
172
173
174
184typedef struct Sound_Sample
185{
186 void *opaque;
188 SDL_AudioSpec desired;
189 SDL_AudioSpec actual;
190 void *buffer;
191 Uint32 buffer_size;
192 Sound_SampleFlags flags;
194
195
196
197/* functions and macros... */
198
217extern SDL_DECLSPEC int SDLCALL Sound_Init(void);
218
219
244extern SDL_DECLSPEC int SDLCALL Sound_Quit(void);
245
246
280extern SDL_DECLSPEC const Sound_DecoderInfo ** SDLCALL Sound_AvailableDecoders(void);
281
282
301extern SDL_DECLSPEC const char * SDLCALL Sound_GetError(void);
302
303
316extern SDL_DECLSPEC void SDLCALL Sound_ClearError(void);
317
318
394extern SDL_DECLSPEC Sound_Sample * SDLCALL Sound_NewSample(SDL_IOStream *io,
395 const char *ext,
396 const SDL_AudioSpec *desired,
397 Uint32 bufferSize);
398
428extern SDL_DECLSPEC Sound_Sample * SDLCALL Sound_NewSampleFromMem(const Uint8 *data,
429 Uint32 size,
430 const char *ext,
431 const SDL_AudioSpec *desired,
432 Uint32 bufferSize);
433
434
466extern SDL_DECLSPEC Sound_Sample * SDLCALL Sound_NewSampleFromFile(const char *filename,
467 const SDL_AudioSpec *desired,
468 Uint32 bufferSize);
469
487extern SDL_DECLSPEC void SDLCALL Sound_FreeSample(Sound_Sample *sample);
488
489
515extern SDL_DECLSPEC Sint32 SDLCALL Sound_GetDuration(Sound_Sample *sample);
516
517
548extern SDL_DECLSPEC int SDLCALL Sound_SetBufferSize(Sound_Sample *sample,
549 Uint32 new_size);
550
551
576extern SDL_DECLSPEC Uint32 SDLCALL Sound_Decode(Sound_Sample *sample);
577
578
616extern SDL_DECLSPEC Uint32 SDLCALL Sound_DecodeAll(Sound_Sample *sample);
617
618
655extern SDL_DECLSPEC int SDLCALL Sound_Rewind(Sound_Sample *sample);
656
657
703extern SDL_DECLSPEC int SDLCALL Sound_Seek(Sound_Sample *sample, Uint32 ms);
704
705#ifdef __cplusplus
706}
707#endif
708
709#endif /* !defined SDL_SOUND_H_ */
710
711/* end of SDL_sound.h ... */
712
Definition SDL_sound.h:166
const char * author
Definition SDL_sound.h:169
const char ** extensions
Definition SDL_sound.h:167
const char * url
Definition SDL_sound.h:170
const char * description
Definition SDL_sound.h:168
Definition SDL_sound.h:185
const Sound_DecoderInfo * decoder
Definition SDL_sound.h:187
Sound_SampleFlags flags
Definition SDL_sound.h:192
void * buffer
Definition SDL_sound.h:190
SDL_AudioSpec actual
Definition SDL_sound.h:189
Uint32 buffer_size
Definition SDL_sound.h:191
SDL_AudioSpec desired
Definition SDL_sound.h:188
void * opaque
Definition SDL_sound.h:186