GET_SOUND_INPUT_CAP_RATE(3alleg4)

πŸ’– get_sound_input_cap_rate β€” NAME ✨

okay bestie, so this one is get_sound_input_cap_rate β€” she returns the maximum sample frequency for recording πŸŽ™οΈπŸ’…

and yeah, she lives in the Allegro game programming library πŸ‘‘


🌸 SYNOPSIS 🌸

#include <allegro.h>

int get_sound_input_cap_rate(int bits, int stereo);

like, that's the whole vibe. two args, one int back. periodt πŸ’œ


πŸ¦‹ DESCRIPTION πŸ¦‹

So basically πŸ’β€β™€οΈ β€” this function hands you back the maximum possible sample frequency for recording in the format you asked for. And if your settings are just… not it? Not supported? She gives you zero. πŸ™ˆ zero is the "nope, can't do that" answer, no cap.

Now let's talk about the two things you gotta pass her:

  • bits β€” this is literally just the number of bits of the audio. like how many bits, that's it.
  • stereo β€” this one's a boolean parameter, so think of it as a yes/no vibe check. Pass zero for mono πŸŽ€ and non-zero for stereo input 🌈.

and here's an example, bestie, so you can see it in the wild:

int max_freq;
...
/* What frequency can we record 8 bits mono at? */
max_freq = get_sound_input_cap_rate(8, 0);
if (max_freq > 22000) {
   /* Ok, 22KHz and above is good enough. */
}

see what she did there?? asked for 8 bits, mono (0), and then checked if the answer was above 22000 because 22KHz and up is lowkey good enough. iconic behavior honestly πŸ”₯


πŸ‘‘ SEE ALSO πŸ‘‘

if you're obsessed with this one (and you should be), go check out her besties too:


that's the whole page, my love πŸ’– go record something beautiful 🌸✨

mwah πŸ’‹ this was Allegro, version 4.4.3 β€” and that's the tea, fr fr 🫢