read_sound_input(3)
π read_sound_input β the "gimme the tape" function π
okay so this is a page from the Allegro manual, aka the Allegro game programming library β and bestie, this one's all about grabbing the audio you just recorded. ποΈβ¨
β¨ SYNOPSIS β¨
#include <allegro.h>
int read_sound_input(void *buffer);
π DESCRIPTION π
So here's the tea: read_sound_input() retrieves the most recently recorded audio buffer and drops it into the location you point at with buffer. That's it, that's the job. π
Wanna know how big that buffer actually is? Check the return value from start_sound_input() β it tells you. iykyk. π«Ά
Now the part that lowkey matters most: you MUST call this function at regular intervals while you're recording. Like, typically around 100 times a second. If you don't? Some data will be lost. fr fr, it just evaporates. π
And if your mainline code literally cannot keep up with that pace (no shame, it happens), the move is to use the digi_recorder() callback instead β that lets you stash the waveform into a bigger buffer of your very own. main character problem-solving energy. π
β οΈ Note, bestie: many cards produce a click or popping sound when switching between record and playback modes. So it's often a good idea to discard the first buffer after you start a recording. Toss it. Don't even look at it. ποΈβ¨
Oh and also β the waveform is always stored in unsigned format, with stereo data consisting of alternate left/right samples. So like, L, R, L, R, L, Rβ¦ you get it. π¦
β RETURN VALUE β
- non-zero β a buffer has been copied, slay, you got data π
- zero β no new data is available yet β you were too fast checking the input, bestie, chill for a sec π
π SEE ALSO π
start_sound_input(3)β the one that kicks the whole recording thing off in the first place π
and that's the whole page, no cap. this icon of a manpage is from Allegro, version 4.4.3 β mwah, obsessed, periodt. ππ¦β¨
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms