al_create_voice(3alleg5)

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

πŸ’– al_create_voice β€” Allegro 5 API πŸ’–

okay bestie, welcome to al_create_voice, a lil function from the Allegro 5 API (that's 3alleg5 to the manual, but we're on a first-name basis here) ✨


🌸 SYNOPSIS 🌸

#include <allegro5/allegro_audio.h>

ALLEGRO_VOICE *al_create_voice(unsigned int freq,
   ALLEGRO_AUDIO_DEPTH depth, ALLEGRO_CHANNEL_CONF chan_conf)

πŸŽ€ DESCRIPTION πŸŽ€

so what this does is: it creates a voice structure and allocates a voice from the digital sound driver. iconic behaviour, honestly πŸ‘‘

the freq you pass in (that's in Hz, btw), plus the sample format and the channel configuration, get used as a hint about what kind of data you're gonna send to the voice. and the way that it's only a hint?? yeah. the underlying sound driver is free to use non-matching values. like, it might just go with the native format of the sound hardware instead. it's giving "I'll do what I want" πŸ’…

now, if a mixer is attached to the voice, the mixer handles the conversion of all its input streams to the voice format, so you literally do not have to worry about it at all. slay. but if you access the voice directly, make sure you don't rely on the parameters you passed to this function β€” instead, query the returned voice for the actual settings. do not skip this step bestie, i'm begging πŸ™ˆ

reasonable default arguments are:

al_create_voice(44100, ALLEGRO_AUDIO_DEPTH_INT16, ALLEGRO_CHANNEL_CONF_2)
ngl those defaults are the moment. copy them, love them, move on 🫢

🌈 SEE ALSO 🌈


that's the whole page, no cap πŸ’– this came straight out of the Allegro reference manual, page al_create_voice(3alleg5) β€” go forth and make sounds, you main character πŸŽ€πŸ¦‹β­

πŸ“¦ where this page comes from