set_hardware_volume(3alleg4)

πŸ’– set_hardware_volume β€” bestie, let's talk about the ACTUAL speakers πŸ’–

okay so real talk: this is a page from the Allegro manual (that's 3alleg4, the Allegro game programming library, mwah πŸ’‹). And set_hardware_volume does exactly what it says on the tin β€” it alters the hardware sound output volume. Not a vibe, not a metaphor. The literal, physical, whole-computer volume. ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro.h>

void set_hardware_volume(int digi_volume, int midi_volume);

that's it. that's the whole signature. two ints and a dream 🫢


🌸 DESCRIPTION 🌸

So like. set_hardware_volume alters the hardware sound output volume. And the way it works is that you specify volumes for both digital samples and MIDI playback β€” both of them, no picking favourites β€” as integers from 0 to 255.

The deets, fr fr:

  • digi_volume is the volume for digital samples πŸ’Ώ
  • midi_volume is the volume for MIDI playback 🎹
  • Both go from 0 to 255. That's the range. Respect it.
  • Wanna leave one of them alone? Pass a negative value and that setting stays exactly how it was. No touchy. πŸ™ˆ
  • Feeling spicy and passing something bigger than 255? Cute. It gets reduced to 255. The cap is the cap, bestie. πŸ‘‘
⚠️ THE BIG ONE, PAY ATTENTION: this routine uses the hardware mixer to control the volume if it exists. And if it exists, that means the volume of ALL the applications on your machine will be affected. Not just yours. Not just the game. Everyone's. You are grabbing the global knob, no cap. 🎚️

And if there's no hardware mixer? Then it just... does nothing. Iconic behaviour honestly, it just stands there πŸ’€


πŸ’… SEE ALSO πŸ’…


🌈 later, bestie 🌈

This was the Allegro manual, version 4.4.3, page set_hardware_volume(3alleg4). Go forth, control the volume of every app on your machine, and be normal about it (you won't be, and that's valid πŸ’œ). mwah! πŸŽ€βœ¨πŸ¦‹