AL_SET_SAMPLE_INSTANCE_CHANNEL_MATRIX(3)

πŸ“¦
version 5.2.11.3 Β· 3 versions
, in arch rolling

πŸ’– al_set_sample_instance_channel_matrix(3) πŸ’–

okay so this page is from the Library Functions Manual, and the whole vibe is the Allegro 5 API. Bestie, this function is the main character for overriding a sample instance’s channel-mix matrix. πŸ’…

🌸 NAME 🌸

al_set_sample_instance_channel_matrix β€” Allegro 5 API

✨ SYNOPSIS ✨

#include <allegro5/allegro_audio.h>

bool al_set_sample_instance_channel_matrix(ALLEGRO_SAMPLE_INSTANCE *spl, const float *matrix)

πŸŽ€ DESCRIPTION πŸŽ€

Set the matrix used to mix the channels coming from this instance into the mixer it is attached to. Normally Allegro derives the values of this matrix from the gain and pan settings, as well as the channel configurations of this instance and the mixer it is attached to β€” but this function lets you override that default value. πŸ‘‘

🚨 real talk: if you do set gain or pan of this instance or the mixer it is attached to, you’ll need to call this function again.

The matrix has mixer channel rows and sample channel columns, and is row major. So rows = mixer channels, columns = sample channels, iykyk. 🧚

For example, if you have a stereo sample instance and want to mix it to a 5.1 mixer you could use this code:

float matrix[] = {
    0.5, 0.0, /* Half left to front left */
    0.0, 0.5, /* Half right to front right */
    0.5, 0.0, /* Half left to rear left */
    0.0, 0.5, /* Half right to rear right */
    0.1, 0.1, /* Mix left and right for center */
    0.1, 0.1, /* Mix left and right for center */
};

al_set_sample_instance_channel_matrix(instance, matrix);

Returns true on success, false on failure (e.g. if this is not attached to a mixer). πŸ’–

πŸ¦‹ SINCE πŸ¦‹

5.2.3

πŸ’€ [Unstable API]: New API.

okay bestie, final footer sign-off: source/version vibes are Allegro reference manual, footer title is al_set_sam...nnel_matrix(3), and no date was printed in the original β€” so I’m not making one up, fr fr. πŸŒˆπŸ’œ

πŸ“¦ where this page comes from
  • arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms