adjust_sample(3)

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

πŸ’– adjust_sample(3) πŸ’–

okay bestie, welcome to the Allegro manual, and today's main character is adjust_sample β€” she alters the parameters of a sample while it is playing. yes, while it's literally still playing. and it's part of the Allegro game programming library, iykyk πŸŽ€


✨ SYNOPSIS ✨

#include <allegro.h>

void adjust_sample(const SAMPLE *spl, int vol, int pan, int freq, int loop);

like, that's the whole signature. five args, no notes πŸ’…


🌸 DESCRIPTION 🌸

so here's the tea: adjust_sample alters the parameters of a sample while it is playing. lowkey this is super useful for manipulating looped sounds β€” like you've got a loop going and you wanna mess with it live, that's your moment πŸ¦‹

what can you change? you can alter the volume, the pan, and the frequency. and you can also clear the loop flag, which will stop the sample when it next reaches the end of its loop. so it's not a hard cut, it's a "finish your sentence then go" situation, no cap.

the values of the parameters are just like those of play_sample(). same energy, same vibes, fr fr.

🫢 one thing though bestie: if there are several copies of the same sample playing, this will adjust the first one it comes across. it does not pick and choose, it does not ask questions. first come, first adjusted.

and if the sample is not playing? it has no effect. literally nothing happens. not a crash, not an error, just silence and a shrug πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘


Allegro, version 4.4.3 β€” and that's the whole page, bestie. go forth and adjust your samples, you absolute icon πŸŒˆβ­πŸ’–

πŸ“¦ where this page comes from