Windows Dev Center

XAudio2 Default Channel Mapping

An XAudio2 client has full control of the mapping from the channels of a voice to the channels of each of its destination voicesIt controls the mapping through the use of the IXAudio2Voice::SetOutputMatrix method. In some circumstances, however, XAudio2 simplifies this task by setting up a default send matrix automatically. It does this by using the channel mask, if any, associated with a voice's audio channels. A channel mask is a combination of SPEAKER_xxx bit masks as defined in X3DAudio.h and elsewhere. XAudio2 requires channel masks to be 0 or have the same number of bits set as the number of channels.

The following table shows the channel mask requirements and defaults for the formats supported by XAudio2.

FormatChannel Mask RequirementDefault MaskCorresponding Structure Member
PCMFile might contain a channel maskChannel mask is 0, or absentWAVEFORMATEXTENSIBLE.dwChannelMask or none (WAVEFORMATEX)
ADPCMFile does not contain a channel maskDefault Channel Mask is always usedNone (ADPCMWAVEFORMAT)

 

For submix and mastering voices, and for source voices without a channel mask or a channel mask of 0, XAudio2 assumes default speaker positions according to the following table.
ChannelsImplicit Channel Positions
1Always maps to FrontLeft and FrontRight at full scale in both speakers (special case for mono sounds)
2FrontLeft, FrontRight (basic stereo configuration)
3FrontLeft, FrontRight, LowFrequency (2.1 configuration)
4FrontLeft, FrontRight, BackLeft, BackRight (quadraphonic)
5FrontLeft, FrontRight, FrontCenter, SideLeft, SideRight (5.0 configuration)
6FrontLeft, FrontRight, FrontCenter, LowFrequency, SideLeft, SideRight (5.1 configuration) (see the following remarks)
7FrontLeft, FrontRight, FrontCenter, LowFrequency, SideLeft, SideRight, BackCenter (6.1 configuration)
8FrontLeft, FrontRight, FrontCenter, LowFrequency, BackLeft, BackRight, SideLeft, SideRight (7.1 configuration)
9 or moreNo implicit positions (one-to-one mapping)

 

If a given voice pair in the audio graph has no speaker positions associated with either its source or target voice (one voice has more than eight channels), neither voice is playable until the source voice has a send matrix set explicitly using the IXAudio2Voice::SetOutputMatrix method. Calling the IXAudio2SourceVoice::Start method for either voice will fail until you do this.

If the source voice and target voice have different numbers of speaker positions and IXAudio2Voice::SetOutputMatrix has not been called on the source voice, XAudio2 sends each source channel to the nearest target speaker (or speakers) available, proportionally to how close they are to the intended speaker. There are two special cases where the default behavior is different.

  1. If the source audio is mono and is positioned at SPEAKER_FRONT_CENTER or has no defined position, it is always sent to SPEAKER_FRONT_LEFT and SPEAKER_FRONT_RIGHT if they exist in the output audio. If they do not exist, it falls back to the normal case.
  2. If the source and destination are both 6-channel and are positioned at either of the standard 5.1 speaker setups (Left+Right+Center+Sub+BackL+BackR or Left+Right+Center+Sub+SideL+SideR), channels are mapped through one to one. In other words, SideLeft/Right and BackLeft/Right are treated equivalently. This is because there has been historical confusion around these setups. Therefore, the assumed intent is always to map one to one.

Related topics

XAudio2 Programming Guide
GetChannelMask

 

 

Community Additions

ADD
Show:
© 2015 Microsoft