ALLEGRO_MIXER(3alleg5)

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

πŸ’– ALLEGRO_MIXER πŸ’–

okay bestie, welcome to the Allegro 5 API manual, mixer edition πŸŽ€ this whole page is part of the Allegro reference manual situation and it's literally about the lil struct that stirs all ur audio together. no cap.


✨ NAME ✨

ALLEGRO_MIXER β€” the Allegro 5 API's very own mixer type, and yes she's iconic πŸ‘‘


🌈 SYNOPSIS 🌈

#include <allegro5/allegro_audio.h>

typedef struct ALLEGRO_MIXER ALLEGRO_MIXER;

that's it. that's the whole vibe. two lines and she's already serving πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so what is a mixer, u ask? bestie. a mixer mixes together all the attached streams into one single buffer. like, one buffer. that's the whole job and she does it flawlessly πŸ’–

and while she's doing that, she's also doing the most β€” converting:

  • channel configurations
  • sample frequencies
  • audio depths

of all the attached sample instances and audio streams, accordingly ✨ so like, everyone shows up looking however they look and she makes them all match. queen behaviour.

and if u wanna control the quality of this conversion? that's a thing u can do! just use ALLEGRO_MIXER_QUALITY πŸŽ€


πŸ’€ the math part (yes there's math, stay with me)

when going from mono to stereo (and above), the mixer reduces the volume of both channels by sqrt(2).

when going from stereo (and above) to mono, the mixer reduces the volume of the left and right channels by sqrt(2) before adding them to the center channel β€” but only if that center channel is present, iykyk.

ngl the sqrt(2) stuff is just the mixer keeping the loudness from getting out of hand when channels get squished together or duplicated. it's giving considerate. it's giving main character energy. periodt 🫢

πŸ‘‘ that's the whole page πŸ‘‘

fr fr, she's short but she's powerful. go mix something beautiful, bestie 🌸


written up all cute from the Allegro reference manual, version 3alleg5 (that's the ALLEGRO_MIXER(3alleg5) footer energy, but make it a sign-off) πŸ§šβ€β™€οΈπŸ’œ bye bye, go read the rest of the Allegro 5 API and slay ⭐

πŸ“¦ where this page comes from