Muokkaa

Jaa


DirectSound Node-Ordering Requirements

A DirectSound 2D or 3D mixer pin should have a node chain that contains the following sequence of nodes:

The nodes in this list appear in the order in which they are encountered by data streaming into the pin. Other nodes can be interleaved between these nodes without causing problems, provided that the above ordering is preserved.

A 2D pin requires all the nodes in the previous list, except for the 3D node, which is optional. A 3D pin requires all the nodes in the list, including the 3D node.

The SRC (sample-rate conversion) node should precede the SUM node. The SRC and SUM nodes are typically adjacent, although this is not a requirement. The IDirectSoundBuffer::SetFrequency method (see Microsoft Windows SDK documentation) perturbs the SRC node's resampling rate.

A mixer that contains only SRC and SUM nodes is sufficient for mixing streams that are managed by system drivers such as SWMidi and Redbook (see SWMidi System Driver and Redbook System Driver), but DirectSound additionally requires that two volume nodes and a supermixer node precede the SUM node. DirectSound sends volume changes resulting from IDirectSoundBuffer::SetVolume calls to the first volume node and sends panning effects from IDirectSoundBuffer::SetPan calls to the second volume node.

DirectSound can produce 3D effects on a 2D pin by using the SetVolume, SetPan, and SetFrequency calls to control the volume and SRC nodes:

  • SetVolume calls can simulate changes in the distance of a sound source from the listener.

  • SetPan calls can simulate changes in orientation of a sound source relative to the listener.

  • SetFrequency calls can simulate Doppler effects and HRTFs (head-related transfer functions).

The supermixer node is a crossbar matrix that connects M input channels to N output channels, where N should be equal to the number of channels in your device's final output stream.

The optional 3D node is required to manage hardware-accelerated 3D effects (see Supporting 3D DirectSound Acceleration in WDM Audio), but is not needed for software-emulated 3D processing. Most existing implementations place the 3D node before the SRC node and between the first volume node and the supermixer node, but other configurations are possible.

The input stream to the 3D node typically contains a single channel. In DirectSound 8.0 and later, only mono PCM buffers can be created with 3D effects. Earlier versions of DirectSound, however, support 3D nodes with both mono and stereo input streams, and drivers should support both to ensure compatibility with older applications.