.\" 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_LoadMUS_IO:
.\"   https://wiki.libsdl.org/SDL_mixer/Mix_LoadMUS_IO
.\" Generated with SDL/build-scripts/wikiheaders.pl
.\"  revision 3~git20250404~68764f3+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_LoadMUS_IO
.\" 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_LoadMUS_IO 3 "SDL_mixer 3.0.0" "SDL_mixer" "SDL_mixer3 FUNCTIONS"
.SH NAME
Mix_LoadMUS_IO \- Load a supported audio format into a music object\[char46]
.SH HEADER FILE
Defined in SDL3_mixer/SDL_mixer\[char46]h

.SH SYNOPSIS
.nf
.B #include \(dqSDL3_mixer/SDL_mixer.h\(dq
.PP
.BI "Mix_Music * Mix_LoadMUS_IO(SDL_IOStream *src, bool closeio);
.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]

If
.BR closeio
is true, the IOStream will be closed before returning, whether
this function succeeds or not\[char46] SDL_mixer reads everything it needs from the
IOStream 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_IOStream:
.BR Mix_LoadMUS("filename\[char46]mp3")
will manage
those details for you\[char46]

This function attempts to guess the file format from incoming data\[char46] If the
caller knows the format, or wants to force it, it should use

.BR Mix_LoadMUSType_IO
() instead\[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_IOStream that data will be read from\[char46]
.TP
.I closeio
true to close the SDL_IOStream before returning, false to leave it open\[char46]
.SH RETURN VALUE
(
.BR Mix_Music
 *) 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 \(bu (3),
.BR Mix_FreeMusic (3)