midi_seek(3alleg4)
π midi_seek β bestie edition π
okay so this is a page from the Allegro manual (the game programming library, you know the one β¨), and it's all about the midi_seek function. let's get into it π
β¨ SYNOPSIS β¨
#include <allegro.h>
int midi_seek(int target);
like. that's it. that's the whole vibe. one int in, one int out π«Ά
πΈ DESCRIPTION πΈ
so midi_seek does exactly what the name says, no cap β it seeks to the given midi_pos in the current MIDI file. main character behaviour tbh.
and here's the lil detail that matters: it's smart about how it gets there π
- if your
targetis earlier in the file than the currentmidi_pos, it seeks from the beginning β like, rewind and start over bestie, we're going back - otherwise (so, target is at or after where you already are) it seeks from the current position β just scooting forward from where you're standing π
so it's not always grinding from zero. only when it has to. iconic.
π₯ RETURN VALUE π₯
okay this part is the actual tea, listen up, because the return value is doing a LOT of storytelling πβ¨
0β slay! π it successfully seeked to the position you asked for. we love a zero. zero is the good one.1β π it stopped playing. AND β and this is the fun bit βmidi_posgets set to the negative length of the MIDI file. so likeβ¦ plot twist, you can literally use this function to figure out how long a MIDI file is. sneaky. clever. obsessed. π§2β π the MIDI file looped back to the start. it did a lil circle. it's back, babes. π
fr fr, read those numbers carefully β1and2are not errors in the "something broke" sense, they're the function telling you what the music did. iykyk π΅
π¦ SEE ALSO π¦
play_midi(3alleg4)β go make some noise bestie πmidi_pos(3alleg4)β the position variable this whole page is about β
and that's the page!! this one came from the Allegro manual, version 4.4.3 β dated like an old classic but still serving π thanks for reading, ily, go seek some midi πβ¨π
π¦ 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