al_play_audio_stream_f(3alleg5)

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

πŸ’– al_play_audio_stream_f β€” NAME πŸ’–

okay bestie, gather round: this is the Allegro 5 API page for al_play_audio_stream_f, and she's a cutie with a very specific job. ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro5/allegro_audio.h>

ALLEGRO_AUDIO_STREAM *al_play_audio_stream_f(ALLEGRO_FILE *fp, const char *ident)

like, that's the whole vibe right there. one function, two args, endless possibilities. πŸ’…


🌸 DESCRIPTION 🌸

So what does she do? She loads and plays an audio file straight out of an ALLEGRO_FILE(3alleg5) stream, and she streams it whenever streaming is needed. no cap. 🎧

🚨 real talk: this API can only play one audio stream at a time. one. singular. she is not sharing the aux. 😭

She also needs a default mixer to already be set up, which β€” plot twist β€” is typically handled for you by al_reserve_samples(3alleg5), but you can also do it yourself with al_set_default_mixer(3alleg5). either way, mixer first, queen. πŸ‘‘

The file type isn't guessed or sniffed or anything β€” it's determined entirely by the ident parameter you pass in, which is a file name extension including the leading dot. so like .ogg, .wav, whatever β€” the dot matters. periodt. πŸ¦‹

Returns the stream on success, and NULL on failure. that's the vibe check. βœ…

Now the important part, listen up:

  • You must not destroy the returned stream. she gets automatically destroyed when the addon is shut down. hands off. πŸ™ˆ
  • On success, the file should be considered owned by the audio stream, and it'll be closed when the audio stream is destroyed.
  • On failure, the file will be closed too. so either way, the file's fate is sealed. πŸ’€
⚠️ Note: the allegro_audio library does not support any audio file formats by default. You must use the allegro_acodec addon, or register your own format handler. otherwise she's just standing there with nothing to play. 🧚

🌈 SEE ALSO 🌈

go read those next, iykyk. πŸ’œ


⭐ SINCE ⭐

5.2.8

[Unstable API]: New API. ✨ she's new here, be nice to her.

and that's the whole page, bestie!! 🫢 this was the al_play_audio_stream_f(3alleg5) page from the Allegro reference manual β€” stay iconic, go stream some audio (one at a time, obviously), and slay. πŸŽ€πŸ’–πŸ”₯

πŸ“¦ where this page comes from