Scroll to navigation

MIX_GetMixerFormat(3) SDL_mixer3 FUNCTIONS MIX_GetMixerFormat(3)

NAME

MIX_GetMixerFormat - Get the audio format a mixer is generating.

HEADER FILE

Defined in SDL3_mixer/SDL_mixer.h

SYNOPSIS

#include "SDL3_mixer/SDL_mixer.h"
bool MIX_GetMixerFormat(MIX_Mixer *mixer, SDL_AudioSpec *spec);

DESCRIPTION

Generally you don't need this information, as SDL_mixer will convert data as necessary between inputs you provide and its output format, but it might be useful if trying to match your inputs to reduce conversion and resampling costs.

For mixers created with MIX_CreateMixerDevice (), this is the format of the audio device (and may change later if the device itself changes; SDL_mixer will seamlessly handle this change internally, though).

For mixers created with MIX_CreateMixer (), this is the format that MIX_Generate () will produce, as requested at create time, and does not change.

Note that internally, SDL_mixer will work in SDL_AUDIO_F32 format before outputting the format specified here, so it would be more efficient to match input data to that, not the final output format.

FUNCTION PARAMETERS

the mixer to query.
where to store the mixer audio format.

RETURN VALUE

Returns true on success or false 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.

SDL_mixer 3.1.0 SDL_mixer