reserve_voices(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

✨ reserve_voices(3) ✨

okay bestie, so this is a page from the Allegro manual β€” like, the actual Allegro game programming library β€” and today we're talking about reserve_voices. it's giving sound-driver-bouncer energy. let's get into it πŸ’–


πŸŽ€ NAME πŸŽ€

reserve_voices</p> β€” reserve a number of voices for the digital and MIDI drivers. Allegro game programming library, no cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <allegro.h>

void reserve_voices(int digi_voices, int midi_voices);

🌸 DESCRIPTION 🌸

so the whole vibe here is: you call this function to specify how many voices are gonna be used by the digital and MIDI sound drivers, respectively. like, digi_voices for the digital one, midi_voices for the MIDI one. two separate numbers, two separate drivers, one little function doing the most πŸ’…

⚠️ and this is the part where you HAVE to pay attention: this must be done _before_ calling install_sound(). before, bestie. not after. not during. before. the ordering is not a suggestion, it's the whole plot.

and like… if you reserve too many voices, the subsequent calls to install_sound() will literally fail. 😭 so don't be greedy.

how many voices are even available? that depends on the driver, babes. every driver's got its own situation going on. and plot twist: in some cases you will actually get more than you reserve. examples, because examples are iconic:

  • the FM synth drivers will always provide 9 voices on an OPL2 and 18 on an OPL3
  • the SB digital driver will round the number of voices up to the nearest power of two

so yeah, you ask for a number, the driver might hand you a slightly different number back. it's giving ✨surprise✨.

also, passing negative values will restore the default settings. so if you've been messing around and you wanna hit undo, that's your move. 🫢

and one more thing, and this one's important for your ears: you should be aware that the sound quality is usually inversely related to how many voices you use. more voices = worse quality, basically. so don't reserve any more than you really need. like, be reasonable. be humble. be minimal. your mix will thank you. πŸ”₯


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the page!! πŸ’–βœ¨ this whole thing comes to you from the Allegro crew, version 4.4.3 β€” yes, that Allegro, the game programming library one, and this page is literally titled reserve_voices(3). go forth and reserve responsibly, bestie πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from