MIX_PlayAudio(3)

NAME
MIX_PlayAudio - Play a MIX_Audio from start to finish without any management.

SYNOPSIS
#include <SDL3_mixer/SDL_mixer.h>

bool MIX_PlayAudio(MIX_Mixer *mixer, MIX_Audio *audio);

DESCRIPTION
This is what we term a "fire-and-forget" sound. Internally, SDL_mixer will manage a temporary track to mix the specified MIX_Audio, cleaning it up when complete. No options can be provided for how to do the mixing, like MIX_PlayTrack() offers, and since the track is not available to the caller, no adjustments can be made to mixing over time.

This is not the function to build an entire game of any complexity around, but it can be convenient to play simple, one-off sounds that can't be stopped early. An example would be a voice saying "GAME OVER" during an unpausable endgame sequence.

There are no limits to the number of fire-and-forget sounds that can mix at once (short of running out of memory), and SDL_mixer keeps an internal pool of temporary tracks it creates as needed and reuses when available.

FUNCTION PARAMETERS

mixer
    the mixer on which to play this audio.

audio
    the audio input to play.

RETURN VALUE
Returns true if the track has begun mixing, false on error; call SDL_GetError() for details.

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
MIX_PlayTrack(3), MIX_LoadAudio(3)