Scroll to navigation

SDL_LoadWAV(3) SDL3 FUNCTIONS SDL_LoadWAV(3)

NAME

SDL_LoadWAV - Loads a WAV from a file path.

SYNOPSIS

#include <SDL3/SDL_audio.h>
bool SDL_LoadWAV(const char *path, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);

DESCRIPTION

This is a convenience function that is effectively the same as:

SDL_LoadWAV_IO(SDL_IOFromFile(path, "rb"), true, spec, audio_buf, audio_len);
    

FUNCTION PARAMETERS

the file path of the WAV file to open.
a pointer to an SDL_AudioSpec that will be set to the WAVE data's format details on successful return.
a pointer filled with the audio data, allocated by the function.
a pointer filled with the length of the audio data buffer in bytes.

RETURN VALUE

for more information.

When the application is done with the data returned in audio_buf, it should call SDL_free() to dispose of it.

THREAD SAFETY

It is safe to call this function from any thread.

AVAILABILITY

This function is available since SDL 3.2.0.

SEE ALSO

SDL_free(3), SDL_LoadWAV_IO(3)

SDL 3.2.14 Simple Directmedia Layer