al_register_sample_saver_f(3alleg5)

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

πŸ’– al_register_sample_saver_f β€” Allegro 5 API πŸ’–

okay bestie, pull up a chair, we're registering a sample saver today and it's gonna be iconic ✨

This one lives in the Allegro 5 manual, so you already know it's giving real-deal game-dev energy πŸŽ€


✨ SYNOPSIS ✨

#include <allegro5/allegro_audio.h>

bool al_register_sample_saver_f(const char *ext,
   bool (*saver)(ALLEGRO_FILE* fp, ALLEGRO_SAMPLE *spl))

like, look at that signature. gorgeous. no notes πŸ’…


🌸 DESCRIPTION 🌸

so basically you're registering a handler for al_save_sample_f(3alleg5). The function you hand over is the one that's gonna be used to handle the saving of sample files with whatever extension you picked. your little custom saver, living its main character life 🫢

Now the ext argument β€” it should include the leading dot (.) character. Don't be skipping it, bestie, it's not optional vibes. And it's gonna be matched case-insensitively, so .WAV and .wav are the same girl, no drama 🌈

The saver argument may be NULL to unregister an entry. Yep, that's the exit strategy πŸ’€

Returns true on success, false on error. And lowkey important: it returns false if you're unregistering an entry that doesn't exist. Like, girl, there's nothing there to unregister 😭

fr fr, don't forget that leading dot or the extension matching will not go how you think.

πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, periodt πŸ’– This was al_register_sample_saver_f(3alleg5) from the Allegro reference manual β€” go forth and save those samples, you absolute icon β­πŸŽ€πŸ’œ

πŸ“¦ where this page comes from