read_sound_input(3alleg4)
π read_sound_input π
okay bestie, so this one lives in the Allegro game programming library manual (that's the 3alleg4 section, iykyk) and it's literally about grabbing the audio you just recorded. let's get into it π
β¨ NAME β¨
read_sound_input β retrieves the last recorded audio buffer. part of the Allegro game programming library, no cap.
πΈ SYNOPSIS πΈ
#include <allegro.h>
int read_sound_input(void *buffer);
π¦ DESCRIPTION π¦
so what it does is: it scoops up the most recently recorded audio buffer and drops it into the location you specified. that's it, that's the whole vibe.
the size of that buffer? you don't guess it, you get it from the return value of start_sound_input(). noted. π
π¨ bestie listen. you must be sure to call this function at regular intervals during the recording β typically around 100 times a second β or some data will be lost. like, gone gone. π
and if you can't hit that pace from your mainline code (no shame, main loops be busy), then use the digi_recorder() callback instead to store the waveform into a larger buffer of your own. problem solved, slay. π
Note: 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. treat it like a lil warm-up, throw it away, don't look back.
also: the waveform is always stored in unsigned format, and stereo data consists of alternate left/right samples. periodt.
β RETURN VALUE β
- non-zero β a buffer has been copied, you ate π«Ά
- zero β no new data is yet available, which means you were too fast checking the input π slow down queen
π SEE ALSO π
and that's the whole page, bestie π this was the Allegro version 4.4.3 rendition of read_sound_input(3alleg4). go forth and record responsibly πβ¨
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms