.\" 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_LoadMUSType_RW: .\" https://wiki.libsdl.org/SDL_mixer/Mix_LoadMUSType_RW .\" Generated with SDL/build-scripts/wikiheaders.pl .\" revision 3~git20240121~3c8461d+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_LoadMUSType_RW .\" 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_LoadMUSType_RW 3 "SDL_mixer 3.0.0" "SDL_mixer" "SDL_mixer3 FUNCTIONS" .SH NAME Mix_LoadMUSType_RW \- Load an audio format into a music object, assuming a specific format\[char46] .SH SYNOPSIS .nf .B #include \(dqSDL3_mixer/SDL_mixer.h\(dq .PP .BI "Mix_Music * Mix_LoadMUSType_RW(SDL_RWops *src, Mix_MusicType type, SDL_bool freesrc); .fi .SH DESCRIPTION SDL_mixer has two separate data structures for audio data\[char46] One it calls a "chunk," which is meant to be a file completely decoded into memory up front, and the other it calls "music" which is a file intended to be decoded on demand\[char46] Originally, simple formats like uncompressed WAV files were meant to be chunks and compressed things, like MP3s, were meant to be music, and you would stream one thing for a game's music and make repeating sound effects with the chunks\[char46] In modern times, this isn't split by format anymore, and most are interchangeable, so the question is what the app thinks is worth predecoding or not\[char46] Chunks might take more memory, but once they are loaded won't need to decode again, whereas music always needs to be decoded on the fly\[char46] Also, crucially, there are as many channels for chunks as the app can allocate, but SDL_mixer only offers a single "music" channel\[char46] This function loads music data, and lets the application specify the type of music being loaded, which might be useful if SDL_mixer cannot figure it out from the data stream itself\[char46] Currently, the following types are supported: - .BR MUS_NONE (SDL_mixer should guess, based on the data) - .BR MUS_WAV (Microsoft WAV files) - .BR MUS_MOD (Various tracker formats) - .BR MUS_MID (MIDI files) - .BR MUS_OGG (Ogg Vorbis files) - .BR MUS_MP3 (MP3 files) - .BR MUS_FLAC (FLAC files) - .BR MUS_OPUS (Opus files) - .BR MUS_WAVPACK (WavPack files) If .BR freesrc is SDL_TRUE, the RWops will be closed before returning, whether this function succeeds or not\[char46] SDL_mixer reads everything it needs from the RWops during this call in any case\[char46] As a convenience, there is a function to read files from disk without having to deal with SDL_RWops: .BR Mix_LoadMUS("filename\[char46]mp3") will manage those details for you (but not let you specify the music type explicitly)\[char46]\[char46] When done with this music, the app should dispose of it with a call to .BR Mix_FreeMusic ()\[char46] .SH FUNCTION PARAMETERS .TP .I src an SDL_RWops that data will be read from\[char46] .TP .I type the type of audio data provided by .BR src \[char46] .TP .I freesrc SDL_TRUE to close/free the SDL_RWops before returning, SDL_FALSE to leave it open\[char46] .SH RETURN VALUE Returns a new music object, or NULL on error\[char46] .SH AVAILABILITY This function is available since SDL_mixer 3\[char46]0\[char46]0\[char46] .SH SEE ALSO .BR Mix_FreeMusic (3)