.\" This manpage content is licensed under Creative Commons .\" Attribution 4.0 International (CC BY 4.0) .\" https://creativecommons.org/licenses/by/4.0/ .\" This manpage was generated from SDL_mixer's wiki page for Mix_Init: .\" https://wiki.libsdl.org/SDL_mixer/Mix_Init .\" Generated with SDL/build-scripts/wikiheaders.pl .\" revision 3~git20240319~12fb85e+ds-1 .\" Please report issues in this manpage's content at: .\" https://github.com/libsdl-org/sdlwiki/issues/new .\" Please report issues in the generation of this manpage from the wiki at: .\" https://github.com/libsdl-org/SDL/issues/new?title=Misgenerated%20manpage%20for%20Mix_Init .\" SDL_mixer can be found at https://libsdl.org/projects/SDL_mixer .de URL \$2 \(laURL: \$1 \(ra\$3 .. .if \n[.g] .mso www.tmac .TH Mix_Init 3 "SDL_mixer 3.0.0" "SDL_mixer" "SDL_mixer3 FUNCTIONS" .SH NAME Mix_Init \- Initialize SDL_mixer\[char46] .SH SYNOPSIS .nf .B #include \(dqSDL3_mixer/SDL_mixer.h\(dq .PP .BI "int Mix_Init(int flags); .fi .SH DESCRIPTION This function loads dynamic libraries that SDL_mixer needs, and prepares them for use\[char46] Note that, unlike other SDL libraries, this call is optional! If you load a music file, SDL_mixer will handle initialization on the fly\[char46] This function will let you know, up front, whether a specific format will be available for use\[char46] Flags should be one or more flags from .BR MIX_InitFlags OR'd together\[char46] It returns the flags successfully initialized, or 0 on failure\[char46] Currently, these flags are: \(bu .BR .BR MIX_INIT_FLAC \(bu .BR .BR MIX_INIT_MOD \(bu .BR .BR MIX_INIT_MP3 \(bu .BR .BR MIX_INIT_OGG \(bu .BR .BR MIX_INIT_MID \(bu .BR .BR MIX_INIT_OPUS \(bu .BR .BR MIX_INIT_WAVPACK More flags may be added in a future SDL_mixer release\[char46] This function may need to load external shared libraries to support various codecs, which means this function can fail to initialize that support on an otherwise-reasonable system if the library isn't available; this is not just a question of exceptional circumstances like running out of memory at startup! Note that you may call this function more than once to initialize with additional flags\[char46] The return value will reflect both new flags that successfully initialized, and also include flags that had previously been initialized as well\[char46] As this will return previously-initialized flags, it's legal to call this with zero (no flags set)\[char46] This is a safe no-op that can be used to query the current initialization state without changing it at all\[char46] Since this returns previously-initialized flags as well as new ones, and you can call this with zero, you should not check for a zero return value to determine an error condition\[char46] Instead, you should check to make sure all the flags you require are set in the return value\[char46] If you have a game with data in a specific format, this might be a fatal error\[char46] If you're a generic media player, perhaps you are fine with only having WAV and MP3 support and can live without Opus playback, even if you request support for everything\[char46] Unlike other SDL satellite libraries, calls to .BR Mix_Init do not stack; a single call to .BR Mix_Quit () will deinitialize everything and does not have to be paired with a matching .BR Mix_Init call\[char46] For that reason, it's considered best practices to have a single .BR Mix_Init and .BR Mix_Quit call in your program\[char46] While this isn't required, be aware of the risks of deviating from that behavior\[char46] After initializing SDL_mixer, the next step is to open an audio device to prepare to play sound (with .BR Mix_OpenAudio ()), and load audio data to play with that device\[char46] .SH FUNCTION PARAMETERS .TP .I flags initialization flags, OR'd together\[char46] .SH RETURN VALUE Returns all currently initialized flags\[char46] .SH AVAILABILITY This function is available since SDL_mixer 3\[char46]0\[char46]0\[char46] .SH SEE ALSO .BR Mix_Quit (3)