al_lock_sample_id(3alleg5)
π NAME π
al_lock_sample_id β the Allegro 5 API girlie that grabs your sample id and hands you the actual instance underneath it π
β¨ SYNOPSIS β¨
#include <allegro5/allegro_audio.h>
ALLEGRO_SAMPLE_INSTANCE* al_lock_sample_id(ALLEGRO_SAMPLE_ID *spl_id)
πΈ DESCRIPTION πΈ
Okay so bestie, listen. al_lock_sample_id locks an ALLEGRO_SAMPLE_ID and gives you back the ALLEGRO_SAMPLE_INSTANCE hiding underneath it. It's giving peek behind the curtain β¨. And why do we care? Because now you can mess with all the properties of that instance β volume, pan, etc. β while the sound is literally playing. Main character mixing energy, no cap π
.
Heads up though: this function returns NULL if the sound that corresponds to the id is no longer playing. So vibe check that return value, fr fr π.
And here's the part that matters, don't skip it π: while it's locked, the ALLEGRO_SAMPLE_ID is unavailable to any additional calls to al_play_sample β even if the sound stops while it's still locked. Like, it's booked and busy, don't come for it. To put that ALLEGRO_SAMPLE_ID back into the pool for reuse, make sure you call al_unlock_sample_id when you're done with the instance. Periodt π«Ά.
π¦ SEE ALSO π¦
β SINCE β
5.2.3
[Unstable API]: New API. Baby's brand new, handle with care π
Written down in the Allegro reference manual, version al_lock_sample_id(3alleg5) β mwah, slay, go lock responsibly, ily π§π
π¦ where this page comes from
- debian trixie: allegro5-doc 2:5.2.10.1+dfsg-1 Β· Zlib
- ubuntu questing: allegro5-doc 2:5.2.10.1+dfsg-1build1
- ubuntu resolute: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- ubuntu stonking: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms