midi_time(3)

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

πŸ’– midi_time(3) πŸ’–

okay bestie, welcome to the Allegro manual ✨ this one's a tiny lil page about a big lil vibe: knowing when in the song you are, in actual seconds πŸŽ€


🌸 SYNOPSIS 🌸

#include <allegro.h>

extern volatile long midi_time;

✨ DESCRIPTION ✨

so like. midi_time holds the position, in seconds, of the midi that's playing right now πŸ’… that's it, that's the whole girl.

and why do you care?? because if you wanna show your player where they are in the song in seconds β€” like a lil 1:37 / 3:12 situation β€” this is literally the variable you reach for 🫢 instead of, yk, trying to do math on beat numbers like some kind of feral gremlin 😭

it's declared extern volatile long, so it's just... sitting there, updating itself while the music goes 🎢 you read it, you display it, you slay πŸ’–

⚠️ heads up: it's volatile for a reason bestie β€” the midi thread is out here changing it whenever it wants, so don't go assuming it'll stay the same value between two reads. that's the whole point of the keyword, iykyk πŸ‘‘

πŸ‘€ SEE ALSO πŸ‘€

  • play_midi(3) β€” the one that actually starts the song 🎡
  • midi_pos(3) β€” same energy, but in beat number instead of seconds πŸ₯
  • get_midi_length(3) β€” so you can do the "of 3:12" part of the display πŸ’«
  • exmidi(3) β€” the example, go look, it ate πŸ”₯

and that's the page, babe πŸ¦‹ go forth and display timestamps like the main character you are ✨

πŸ’– this was midi_time(3) from the Allegro manual, version 4.4.3 πŸ’– mwah, love u, bye πŸ‘‘

πŸ“¦ where this page comes from