This module provide support for playing music. In contrast to sounds only one music can be played at a time.
Optional music flags that can be OR'ed in functions which use them.
||Loop the music.|
This structure has no public editable fields but is still publicly exposed to allow stack allocation.
Open a music file from
path and store the result into
mus. Returns false on
errors, in this case
mus remains uninitialized and must not be used.
bool music_open(struct music *mus, const char *path)
Open a music from the memory
buffer of size
buffersz and store the result
mus. Returns false on errors, in this case
mus remains uninitialized
and must not be used.
buffer must stay valid until the font is no longer used.
bool music_openmem(struct music *mus, const void *buffer, size_t buffersz)
Returns true if the music
mus is properly initialized.
bool music_ok(const struct music *mus)
Start playing the given music
flags can control the playback options and if
fadein is greater
than 0 it will fade in during the number of specified milliseconds.
This function will resume the playback since the beginning and will stop the current music. If the music playing is currently fading out the playback will not start until it has finished.
bool music_play(struct music *mus, enum music_flags flags, unsigned int fadein)
Returns true if a music is playing.
Pause the music playback immediately.
Resume the music playback immediately.
Stop the music playback, applying an optional
fadeout delay expressed in
void music_stop(unsigned int fadeout)
Close the music
mus, if it is playing it is immediately stopped.
void music_finish(struct music *mus)