Wiki Page Content

Differences between revisions 9 and 10
Revision 9 as of 2010-10-12 00:43:57
Size: 793
Editor: SheenaSmith
Comment: update content - pointers, structs
Revision 10 as of 2013-08-08 05:16:20
Size: 829
Editor: RyanGordon
Comment: Rewritten
Deletions are marked like this. Additions are marked like this.
Line 15: Line 15:
||'''audio_buf'''||,,a pointer to ,,the buffer created by [[SDL_LoadWAV]]() or [[SDL_LoadWAV_RW]]()|| ||'''audio_buf'''||a pointer to the buffer created by [[SDL_LoadWAV]]() or [[SDL_LoadWAV_RW]]()||
Line 21: Line 21:
*<<BR>>After a WAVE file has been opened with [[SDL_LoadWAV]]() or [[SDL_LoadWAV_RW]]() its data can eventually be freed with [[SDL_FreeWAV]]().<<BR>>* After a WAVE file has been opened with [[SDL_LoadWAV]]() or [[SDL_LoadWAV_RW]]() its data can eventually be freed with [[SDL_FreeWAV]](). It is safe to call this function with a NULL pointer.

SDL_FreeWAV

Use this function to free data previously allocated with SDL_LoadWAV() or SDL_LoadWAV_RW().

Syntax

void SDL_FreeWAV(Uint8* audio_buf)

Function Parameters

audio_buf

a pointer to the buffer created by SDL_LoadWAV() or SDL_LoadWAV_RW()

Code Examples

SDL_AudioSpec wav_spec;
Uint32 wav_length;
Uint8 *wav_buffer;

/* Load the WAV */
if (SDL_LoadWAV("test.wav", &wav_spec, &wav_buffer, &wav_length) == NULL) {
    fprintf(stderr, "Could not open test.wav: %s\n", SDL_GetError());
} else {
    /* Do stuff with the WAV data, and then... */
    SDL_FreeWAV(wav_buffer);
}

Remarks

After a WAVE file has been opened with SDL_LoadWAV() or SDL_LoadWAV_RW() its data can eventually be freed with SDL_FreeWAV(). It is safe to call this function with a NULL pointer.


CategoryAPI, CategoryAudio

None: SDL_FreeWAV (last edited 2013-08-08 05:16:20 by RyanGordon)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit