play_midi(3alleg4)
π play_midi β the Allegro manual, but make it cute π
okay bestie, welcome to the Allegro manual π this one lives in section 3 (3alleg4), it's part of the Allegro game programming library, and today we're talking about play_midi β the function that makes your game go π΅β¨
β¨ NAME β¨
play_midi β starts playing the specified MIDI file. Allegro game programming library. no cap, that's literally it, and it's iconic for it π
πΈ SYNOPSIS πΈ
#include <allegro.h>
int play_midi(MIDI *midi, int loop);
she's short, she's simple, she takes a MIDI * and an int, and she EATS π₯
π¦ DESCRIPTION π¦
So here's the vibe: play_midi starts playing the specified MIDI file, and the first thing it does β before anything else β is stop whatever music was previously playing. no overlap, no messy transitions, one track at a time, periodt π
Then there's the loop flag, and bestie this is the whole personality of the function:
- if
loopis set to non-zero, the data will be repeated until replaced with something else β it just goes and goes and goes, main character energy π - otherwise it will stop at the end of the file, and that's that, a lil finite bop πΆ
And the sneaky one: passing a NULL pointer will stop whatever music is currently playing. that's right, NULL is your "shut it down" button, she's giving silence as a feature π
π RETURN VALUE π
Returns non-zero if an error occurs π and ngl the docs are very honest about when that might happen: this 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 :-)
yes the manpage really did put a smiley in there. we love a humble king π«Ά
π SEE ALSO π
the whole friend group, go say hi π
install_sound(3alleg4)load_midi(3alleg4)play_looped_midi(3alleg4)stop_midi(3alleg4)midi_pause(3alleg4)midi_seek(3alleg4)midi_pos(3alleg4)midi_time(3alleg4)midi_msg_callback(3alleg4)exmidi(3alleg4)
and that's the page, bestie π this was Allegro version 4.4.3, and the page is play_midi(3alleg4) β mwah, go make some music, iykyk β¨π
π¦
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms