get_audio_stream_buffer(3)
NAME π
get_audio_stream_buffer β the lil function that tells you if you need to fill the audiostream or not, bestie. Part of the Allegro game programming library. π
β¨ SYNOPSIS β¨
#include <allegro.h>
void *get_audio_stream_buffer(AUDIOSTREAM *stream);
π DESCRIPTION π
okay so. when your audio stream is playing, you have to call this function at regular intervals β like, on a schedule, no skipping β so it can hand you the next buffer of sample data to fill. π«Ά
and the tea is: the smaller your stream buffer size, the more often you gotta call it. no cap. tiny buffer = needy buffer.
π« do NOT call this from a timer handler. literally just don't. it's giving chaos.
here's the vibe, in code form:
void *mem_chunk;
...
while (TRUE) {
...
mem_chunk = get_audio_stream_buffer(buffer);
if (mem_chunk != NULL) {
/* Refill the stream buffer. */
}
}
πΈ RETURN VALUE πΈ
- if it returns
NULLβ the stream is still playing the previous lot of data, so you genuinely don't need to do anything. relax, queen. π€ - if it returns a value β that's the location of the next buffer to be played, and you should load the appropriate number of samples (however many you specified when creating the stream, iykyk) right to that address β for example using an
fread()from a disk file. π
then, after you fill that buffer with data, you call free_audio_stream_buffer() to let it know the new data is now valid. periodt. π
π¦ SEE ALSO π¦
and that's the whole page, bestie!! β¨ this was Allegro, version 4.4.3, and the page is get_audio_stream_buffer(3) β go stream something cute, mwah πππ
π¦ 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