Scroll to navigation

MIX_LoadRawAudio_IO(3) SDL_mixer3 FUNCTIONS MIX_LoadRawAudio_IO(3)

NAME

MIX_LoadRawAudio_IO - Load raw PCM data from an SDL_IOStream.

HEADER FILE

Defined in SDL3_mixer/SDL_mixer.h

SYNOPSIS

#include "SDL3_mixer/SDL_mixer.h"
MIX_Audio * MIX_LoadRawAudio_IO(MIX_Mixer *mixer, SDL_IOStream *io, const SDL_AudioSpec *spec, bool closeio);

DESCRIPTION

There are other options for _streaming_ raw PCM: an SDL_AudioStream can be connected to a track, as can an SDL_IOStream, and will read from those sources on-demand when it is time to mix the audio. This function is useful for loading static audio data that is meant to be played multiple times.

This function will load the raw data in its entirety and cache it in RAM.

MIX_Audio
objects can be shared between multiple mixers. The mixer parameter just suggests the most likely mixer to use this audio, in case some optimization might be applied, but this is not required, and a NULL mixer may be specified.

FUNCTION PARAMETERS

a mixer this audio is intended to be used with. May be NULL.
the SDL_IOStream to load data from.
what format the raw data is in.
true if SDL_mixer should close io before returning (success or failure).

RETURN VALUE

( MIX_Audio
*) Returns an audio object that can be used to make sound on a mixer, or NULL on failure; call SDL_GetError() for more information.

THREAD SAFETY

It is safe to call this function from any thread.

AVAILABILITY

This function is available since SDL_mixer 3.0.0.

SEE ALSO

(3), MIX_DestroyAudio(3), (3), MIX_SetTrackAudio(3), (3), MIX_LoadRawAudio(3), (3), MIX_LoadRawAudioNoCopy(3), (3), MIX_LoadAudio_IO(3)

SDL_mixer 3.1.0 SDL_mixer