1al_set_sample_instance_channel_matrix(3a)l_set_sample_instance_channel_matrix(3)
2
3
4
6 al_set_sample_instance_channel_matrix - Allegro 5 API
7
9 #include <allegro5/allegro_audio.h>
10
11 bool al_set_sample_instance_channel_matrix(ALLEGRO_SAMPLE_INSTANCE *spl, const float *matrix)
12
14 Set the matrix used to mix the channels coming from this instance into
15 the mixer it is attached to. Normally Allegro derives the values of
16 this matrix from the gain and pan settings, as well as the channel con‐
17 figurations of this instance and the mixer it is attached to, but this
18 allows you override that default value. Note that if you do set gain
19 or pan of this instance or the mixer it is attached to, you'll need to
20 call this function again.
21
22 The matrix has mixer channel rows and sample channel columns, and is
23 row major. For example, if you have a stereo sample instance and want
24 to mix it to a 5.1 mixer you could use this code:
25
26 float matrix[] = {
27 0.5, 0.0, /* Half left to front left */
28 0.0, 0.5, /* Half right to front right */
29 0.5, 0.0, /* Half left to rear left */
30 0.0, 0.5, /* Half right to rear right */
31 0.1, 0.1, /* Mix left and right for center */
32 0.1, 0.1, /* Mix left and right for center */
33 };
34
35 al_set_sample_instance_channel_matrix(instance, matrix);
36
37 Returns true on success, false on failure (e.g. if this is not at‐
38 tached to a mixer).
39
41 5.2.3
42
43 [Unstable API]: New API.
44
45
46
47Allegro reference manual al_set_sample_instance_channel_matrix(3)