al_register_sample_loader(3alleg5)
π al_register_sample_loader π
okay bestie, welcome to the Allegro 5 API β yes that's 3alleg5, that's the manual we're in, and today we're talking about teaching Allegro how to open your weird little audio file format. let's go π
β¨ NAME β¨
al_register_sample_loader β the glow-up that lets al_load_sample handle a brand new file extension, no cap π
πΈ SYNOPSIS πΈ
#include <allegro5/allegro_audio.h>
bool al_register_sample_loader(const char *ext,
ALLEGRO_SAMPLE *(*loader)(const char *filename))
π¦ DESCRIPTION π¦
so here's the tea π β you call this and you're basically registering a handler for al_load_sample(3alleg5). the function you hand over? that's the one that's gonna be in charge of loading sample files that have the extension you picked.
the extension you pass in should include the leading dot (the . character). and the way it gets matched? case-insensitively. so like .WAV and .wav are the same vibe, she doesn't care β¨
the loader argument can be NULL β and that's you unregistering an entry, lowkey a breakup π
as for the return value: it gives you back true on success, false on error. and heads up π β it also returns false if you try to unregister an entry that doesn't even exist. yeah. nothing to cancel, bestie π
ngl that last one is important: unregistering something that was never registered = false. don't be surprised, it's not a bug, it's just honest fr fr.
π SEE ALSO π
al_register_sample_loader_f(3alleg5)β the fancy float-y sibling π§al_register_sample_saver(3alleg5)β for when you're saving instead of loading, iconic β
and that's the whole page, bestie π«Ά β this was pulled straight from the Allegro reference manual, and yes, al_register_sample_loader(3alleg5) is the manual name, so if you ever need to cite her, that's the one π go forth and load your samples π
β¨
π¦ 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