midi_loop_start(3alleg4)
π midi_loop_start π
ok so bestie, we're in the Allegro manual, and today's hyperfixation is midi_loop_start (plus its ride-or-die twin midi_loop_end). this is a page from the Allegro game programming library, and it's short but it is important, so lock in π«Ά
β¨ SYNOPSIS β¨
#include <allegro.h>
extern long midi_loop_start;
extern long midi_loop_end;
like. two whole globals. that's the whole vibe. two longs just out there living their lives π
π DESCRIPTION π
so these two are the loop start and end points, and they get set by the play_looped_midi() function. that's it, that's their whole origin story. play_looped_midi() sets them, you read them, everyone's happy.
here's the part where you actually have to pay attention though π
- you can safely alter these while the music is playing. yes, live. mid-song. main character behaviour, honestly.
- BUT you gotta make sure they're always set to sensible values, and by sensible we mean
start < end. no cap. - if you're changing both of them at the same time, you must alter them in the right order, because a MIDI interrupt could literally happen in between your two writes. the way that a MIDI interrupt can just sneak in there mid-write?? π
fr fr, be careful with the ordering here. if an interrupt lands between your two writes and the pair is momentarily nonsense, that's on you, bestie.
and the cherry on top: setting either of these values to -1 represents the start and end of the file respectively. so -1 for start = beginning of the file, -1 for end = end of the file. iconic little shortcut, ngl π
π SEE ALSO π
play_looped_midi(3alleg4)β the function that sets all of this up in the first place, go read it π
and that's the page!! tysm for reading, go forth and loop your MIDI responsibly π
this little love letter to you came from Allegro version 4.4.3 β mwah, bye bestie π§β¨
π¦ 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