DSSPEAKER_SURROUND Speaker Configuration

Note  This information applies to Windows XP and earlier operating systems. Starting with Windows Vista, IDirectSound::GetSpeakerConfig and IDirectSound::SetSpeakerConfig have been deprecated.

An application program can change the DirectSound speaker configuration to surround mode by calling the IDirectSound::SetSpeakerConfig method with the speaker-configuration parameter set to DSSPEAKER_SURROUND. This specifies a four-channel PCM format in which the channels are mapped to left, right, center, and back speakers.

Once it takes effect, the DSSPEAKER_SURROUND speaker-configuration setting is global and affects the audio device as a whole. All audio applications that subsequently run are subject to the new setting until DirectSound changes the setting again.

DirectSound uses the following algorithm to configure the audio system for surround mode:

  1. DirectSound first asks the driver to go into the surround speaker mode by sending a KSPROPERTY_AUDIO_CHANNEL_CONFIG set-property request to the driver's DAC node (or 3D node if it has no DAC node). (See KSNODETYPE_DAC and KSNODETYPE_3D_EFFECTS.) The KSAUDIO_CHANNEL_CONFIG structure that accompanies this property request specifies the KSAUDIO_SPEAKER_SURROUND speaker configuration. If the request succeeds, the audio device routes the four channels to four analog outputs that are connected directly to left, right, center, and back speakers.

  2. If that fails, DirectSound asks the driver to configure the device in stereo speaker mode and to enable its KSNODETYPE_PROLOGIC_ENCODER node, if it has one. If this succeeds, the device converts the four-channel stream from the application to a surround-encoded stereo signal that it outputs in either digital or analog form. (The hardware should do the encoding after mixing the streams that flow into the device's various mixer pins.) The user can connect the device's stereo outputs to an external decoder that converts the encoded signal into four channels that are output to left, right, center, and back speakers.

  3. If that fails, DirectSound enables the KSNODETYPE_PROLOGIC_ENCODER node in KMixer. (The device is already in stereo mode from the previous step.) Again, the stereo signal that is output by the device can be fed to an external decoder.

If this algorithm succeeds, the application can create and play four-channel PCM buffers. In cases 1 and 2 above, the hardware buffers that the device reads from use four channels, but in case 3 the hardware buffers use a stereo format. The application can write directly to the hardware buffers in cases 1 and 2, but in case 3 it should write to a software buffer and allow KMixer to convert the application's four-channel stream to the surround-encoded stereo format needed for the hardware buffer.

In case (3) above, the application should avoid using hardware buffers for any of its output streams. Note that KMixer mixes all its input streams before encoding the mix to produce the surround stereo stream. However, any stream that enters a hardware mixer pin is mixed in hardware with the encoded stereo from KMixer, which degrades the quality of the surround audio when it is decoded. The application can prevent this by using only software buffers.

A stereo stream that has been surround-encoded by a KSNODETYPE_PROLOGIC_ENCODER node can be decoded into four channels (left, right, center, and back) by a KSNODETYPE_PROLOGIC_DECODER node.



Send comments about this topic to Microsoft

© 2014 Microsoft