al_register_a...tream_loader_f(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ al_register_audio_stream_loader_f ✨

okay bestie, welcome to the Allegro 5 API section of the manual (it's the 3alleg5 one, iykyk) πŸ’– this one's all about teaching Allegro how to open YOUR custom audio stream files. let's get into it πŸŽ€


🌸 SYNOPSIS 🌸

#include <allegro5/allegro_audio.h>

bool al_register_audio_stream_loader_f(const char *ext,
   ALLEGRO_AUDIO_STREAM *(*stream_loader)(ALLEGRO_FILE* fp,
      size_t buffer_count, unsigned int samples))

like… look at that function signature. she's long. she's gorgeous. she ate πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so basically, you're registering a handler for al_load_audio_stream_f(3alleg5) and al_play_audio_stream_f(3alleg5). the function you hand over gets used to open streams from files that have the extension you specified. that's the whole vibe ✨

some things you gotta know, no cap:

  • the extension should include the leading dot ('.') character. yes, the dot. don't skip the dot. the dot matters πŸ™ˆ
  • it gets matched case-insensitively, so don't stress about capitalization fr fr
  • the stream_loader argument can be NULL to unregister an entry πŸ‘‘

and the returns? very simple, very demure:

  • returns true on success 🫢
  • returns false on error πŸ’€
  • also returns false if you're trying to unregister an entry that doesn't exist. like… girl, that entry was never there 😭
lowkey important: NULL for stream_loader = unregister mode. that's not a bug, that's a feature, periodt.

🌈 SEE ALSO 🌈


and that's the whole page, bestie!! this came straight from the Allegro reference manual, 3alleg5 era, and honestly? iconic. now go register some stream loaders and slay βœ¨πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from