play_midi(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

πŸ’– play_midi(3) πŸ’–

okay bestie, welcome to the Allegro manual, and today's main character is play_midi β€” she starts playing the specified MIDI file. Allegro game programming library, you know the vibe πŸŽ€


✨ SYNOPSIS ✨

#include <allegro.h>

int play_midi(MIDI *midi, int loop);

🌸 DESCRIPTION 🌸

So like, play_midi starts playing the specified MIDI file. but first?? it stops whatever music was previously playing. no overlap, no chaos, we are not doing two songs at once, that's not the vibe πŸ’…

If the loop flag is set to non-zero, the data will be repeated until replaced with something else β€” infinite loop era, main character energy, she will literally never stop until you give her something new to play πŸ”₯

Otherwise (loop = 0, the chill path), it will stop at the end of the file. natural ending, credits roll, beautiful πŸ¦‹

And okay this part is lowkey iconic: passing a NULL pointer will stop whatever music is currently playing. yes bestie, silence is also a valid request, we respect it πŸ’œ


⭐ RETURN VALUE ⭐

Returns non-zero if an error occurs 😭

When might that happen?? well, it may happen if a patch-caching wavetable driver is unable to load the required samples. or at least it might in the future when somebody writes some patch-caching wavetable drivers :-) β€” that's literally what the docs say, i'm not making this up, the parentheses smiley is canon πŸ™ˆ


🫢 SEE ALSO 🫢


and that's the whole page, bestie 🌈 this one came from the Allegro manual, version 4.4.3 β€” go read the whole crew, they all ate πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from