Better pack HRTF mixing properties
[openal-soft.git] / examples / common / sdl_sound.h
blobe93ab92bb767cd7b5948c4ebf06ca1d2a4c52b08
1 #ifndef EXAMPLES_SDL_SOUND_H
2 #define EXAMPLES_SDL_SOUND_H
4 #include "AL/al.h"
6 #include <SDL_sound.h>
8 #ifdef __cplusplus
9 extern "C" {
10 #endif /* __cplusplus */
12 /* Opaque handles to files and streams. Apps don't need to concern themselves
13 * with the internals */
14 typedef Sound_Sample *FilePtr;
16 /* Opens a file with SDL_sound, and specifies the size of the sample buffer in
17 * milliseconds. */
18 FilePtr openAudioFile(const char *fname, size_t buftime_ms);
20 /* Closes/frees an opened file */
21 void closeAudioFile(FilePtr file);
23 /* Returns information about the given audio stream. Returns 0 on success. */
24 int getAudioInfo(FilePtr file, ALuint *rate, ALenum *channels, ALenum *type);
26 /* Returns a pointer to the next available chunk of decoded audio. The size (in
27 * bytes) of the returned data buffer is stored in 'length', and the returned
28 * pointer is only valid until the next call to getAudioData. */
29 uint8_t *getAudioData(FilePtr file, size_t *length);
31 /* Decodes all remaining data from the stream and returns a buffer containing
32 * the audio data, with the size stored in 'length'. The returned pointer must
33 * be freed with a call to free(). Note that since this decodes the whole
34 * stream, using it on lengthy streams (eg, music) will use a lot of memory.
35 * Such streams are better handled using getAudioData to keep smaller chunks in
36 * memory at any given time. */
37 void *decodeAudioStream(FilePtr, size_t *length);
39 #ifdef __cplusplus
41 #endif /* __cplusplus */
43 #endif /* EXAMPLES_SDL_SOUND_H */