The KSAUDIO_CHANNEL_CONFIG structure specifies the configuration of channels within the data format of an audio stream.
typedef struct
{
LONG ActiveSpeakerPositions;
} KSAUDIO_CHANNEL_CONFIG, *PKSAUDIO_CHANNEL_CONFIG;
Declared in ksmedia.h. Include ksmedia.h.
This structure is used to set or get the data value for the KSPROPERTY_AUDIO_CHANNEL_CONFIG property.
The following table shows the flag bits that are defined for the ActiveSpeakerPositions member.
| Speaker Position | Flag Bit |
|---|---|
| SPEAKER_FRONT_LEFT | 0x1 |
| SPEAKER_FRONT_RIGHT | 0x2 |
| SPEAKER_FRONT_CENTER | 0x4 |
| SPEAKER_LOW_FREQUENCY | 0x8 |
| SPEAKER_BACK_LEFT | 0x10 |
| SPEAKER_BACK_RIGHT | 0x20 |
| SPEAKER_FRONT_LEFT_OF_CENTER | 0x40 |
| SPEAKER_FRONT_RIGHT_OF_CENTER | 0x80 |
| SPEAKER_BACK_CENTER | 0x100 |
| SPEAKER_SIDE_LEFT | 0x200 |
| SPEAKER_SIDE_RIGHT | 0x400 |
| SPEAKER_TOP_CENTER | 0x800 |
| SPEAKER_TOP_FRONT_LEFT | 0x1000 |
| SPEAKER_TOP_FRONT_CENTER | 0x2000 |
| SPEAKER_TOP_FRONT_RIGHT | 0x4000 |
| SPEAKER_TOP_BACK_LEFT | 0x8000 |
| SPEAKER_TOP_BACK_CENTER | 0x10000 |
| SPEAKER_TOP_BACK_RIGHT | 0x20000 |
Each audio data format contains channels for one or more of the preceding speaker positions. The number of channels simply equals the number of nonzero flag bits in the ActiveSpeakerPositions member.
The relative positions of the channels within each block of audio data always follow the same relative ordering as the flag bits in the preceding table. For example, if ActiveSpeakerPositions contains the value 0x00000033, the format defines four audio channels that are assigned for playback to the front-left, front-right, back-left, and back-right speakers, respectively. The channel data should be interleaved in that order within each block. (This is the KSAUDIO_SPEAKER_QUAD configuration that appears in the second table below.)
The following table shows the speaker configurations that are defined for DVD.
| Configuration | Speaker Position |
|---|---|
| KSAUDIO_SPEAKER_GROUND_FRONT_LEFT | SPEAKER_FRONT_LEFT |
| KSAUDIO_SPEAKER_GROUND_FRONT_CENTER | SPEAKER_FRONT_CENTER |
| KSAUDIO_SPEAKER_GROUND_FRONT_RIGHT | SPEAKER_FRONT_RIGHT |
| KSAUDIO_SPEAKER_GROUND_REAR_LEFT | SPEAKER_BACK_LEFT |
| KSAUDIO_SPEAKER_GROUND_REAR_RIGHT | SPEAKER_BACK_RIGHT |
| KSAUDIO_SPEAKER_TOP_MIDDLE | SPEAKER_TOP_CENTER |
| KSAUDIO_SPEAKER_SUPER_WOOFER | SPEAKER_LOW_FREQUENCY |
The following table shows the speaker configurations that are defined for DirectSound.
| Configuration | Speaker Positions |
|---|---|
| KSAUDIO_SPEAKER_DIRECTOUT | 0 (no speakers) |
| KSAUDIO_SPEAKER_MONO | (SPEAKER_FRONT_CENTER) |
| KSAUDIO_SPEAKER_STEREO | (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT) |
| KSAUDIO_SPEAKER_QUAD | (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT) |
| KSAUDIO_SPEAKER_SURROUND | (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER) |
| KSAUDIO_SPEAKER_5POINT1 | (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT) |
| KSAUDIO_SPEAKER_7POINT1 | (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_FRONT_LEFT_OF_CENTER | SPEAKER_FRONT_RIGHT_OF_CENTER) |
In the preceding table, the constant KSAUDIO_SPEAKER_DIRECTOUT has a value of zero, which means that no speaker positions are assigned to the channels in the multichannel stream. For example, channel zero might represent percussion, channel 1 might represent trumpet, channel 2 might represent voice, and so on. In this configuration, the channels in the input stream are output directly to the hardware without modification and without being interpreted as speaker positions. For more information, see DSSPEAKER_DIRECTOUT Speaker Configuration.
The speaker configuration for a 5.1-channel format is defined by the constant KSAUDIO_SPEAKER_5POINT1 in the preceding table. The geometric layout of the speakers is shown in the following figure, which shows the positions of the front-left, front-right, front-center, back-left, and back-right speakers. The figure omits the low-frequency speaker because it is nondirectional.

A 5.1-Channel Speaker Configuration (Low-Frequency Speaker Not Shown)
For this example, the ordering of the six channels within each block of audio data is as follows:
Assuming a PCM format with a 16-bit sample size, each block of audio data occupies 12 bytes, which are ordered as shown in the following figure.

Ordering of Bytes for the 5.1-Channel Example