1SDL_LoadWAV(3)                 SDL API Reference                SDL_LoadWAV(3)
2
3
4

NAME

6       SDL_LoadWAV - Load a WAVE file
7

SYNOPSIS

9       #include "SDL.h"
10
11       SDL_AudioSpec *SDL_LoadWAV(const char *file, SDL_AudioSpec *spec, Uint8
12       **audio_buf, Uint32 *audio_len);
13

DESCRIPTION

15       SDL_LoadWAV This function loads a WAVE file into memory.
16
17       If this function succeeds, it returns the given  SDL_AudioSpec,  filled
18       with  the  audio  data format of the wave data, and sets audio_buf to a
19       malloc'd buffer containing the audio data, and sets  audio_len  to  the
20       length  of that audio buffer, in bytes. You need to free the audio buf‐
21       fer with SDL_FreeWAV when you are done with it.
22
23       This function returns NULL and sets the SDL error message if  the  wave
24       file cannot be opened, uses an unknown data format, or is corrupt. Cur‐
25       rently raw, MS-ADPCM and IMA-ADPCM WAVE files are supported.
26

EXAMPLE

28       SDL_AudioSpec wav_spec;
29       Uint32 wav_length;
30       Uint8 *wav_buffer;
31
32       /* Load the WAV */
33       if( SDL_LoadWAV("test.wav", &wav_spec, &wav_buffer, &wav_length) == NULL ){
34         fprintf(stderr, "Could not open test.wav: %s
35       ", SDL_GetError());
36         exit(-1);
37       }
38       .
39       .
40       .
41       /* Do stuff with the WAV */
42       .
43       .
44       /* Free It */
45       SDL_FreeWAV(wav_buffer);
46

SEE ALSO

48       SDL_AudioSpec, SDL_OpenAudio, SDL_FreeWAV
49
50
51
52SDL                         Tue 11 Sep 2001, 22:58              SDL_LoadWAV(3)
Impressum