mixPlayAudio function mixer
Play a MIX_Audio from start to finish without any management.
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.
\param mixer the mixer on which to play this audio. \param audio the audio input to play. \returns true if the track has begun mixing, false on error; call SDL_GetError() for details.
\threadsafety It is safe to call this function from any thread.
\since This function is available since SDL_mixer 3.0.0.
\sa MIX_PlayTrack \sa MIX_LoadAudio
extern SDL_DECLSPEC bool SDLCALL MIX_PlayAudio(MIX_Mixer *mixer, MIX_Audio *audio)
Implementation
bool mixPlayAudio(Pointer<MixMixer> mixer, Pointer<MixAudio> audio) {
final mixPlayAudioLookupFunction = _libMixer
.lookupFunction<
Uint8 Function(Pointer<MixMixer> mixer, Pointer<MixAudio> audio),
int Function(Pointer<MixMixer> mixer, Pointer<MixAudio> audio)
>('MIX_PlayAudio');
return mixPlayAudioLookupFunction(mixer, audio) == 1;
}