DirectSound issues

Virtual Audio Cable

DirectSound issues in Windows 5.x

Target device testing

Before using a target device, an application or DirectSound subsystem itself often performs some testing, repeatedly opening the device with various audio formats to see which of them are supported. Such testing is usually performed at Windows boot, at DirectSound application startup and at DirectSound device selection.

Most devices can be successfully opened in any time with any audio format they support. But a Virtual Cable can restrict possible stream format range and reject open requests that specify "bad" formats. Due to that, some DirectSound applications may fail to select this cable or may unable to start at all. You might need to stop all cable activity to allow such applications to initialize properly. Or you might even need to set less restrictive format range and/or stream format limiting mode before starting this application and restore appropriate values again when application finishes its initialization.

Using hardware acceleration

In Windows 5.x, DirectSound offers a hardware acceleration feature that allows to utilize some internal audio device capabilities. One of these capabilities allow a multistream playback and recording. It means that a device can process multiple audio streams at a same time and its driver can create multiple pin instances in parallel. Multistream feature allows several applications to use a device simultaneously without a special sharing support in software. Each application creates one or more streams and a device processes all of them appropriately. For example, if an internal hardware DSP can resample and mix several streams, it reduces main CPU load and allow applications to be more flexible in audio format selection.

Although VAC has no proprietary hardware and uses only main CPU resources, it reports a hardware acceleration support to allow Windows audio subsystem to create multiple pin instances (streams). When an application creates a hardware-accelerated DirectSound buffer, Windows audio subsystem requests a new pin instance from the driver. At a driver side, a new audio stream is created (number of active streams is displayed by the VAC Control Panel). Having several audio streams, VAC converts their formats to the cable format and then mixes together.

Each cable can create as many pin instances as specified by the maximum instances configuration parameter. If there are no available instances, DirectSound fails to create a hardware-accelerated buffer. For an ordinary buffer, DirectSound can create a new stream in System Audio Engine layer. In such case, System Audio Engine will convert and mix these streams instead of the VAC. So you can control how application's audio data will be processed.

Sometimes you can control application's ability to use hardware acceleration features. For example, WinAMP and Foobar2000 players have checkboxes for it.

Hardware acceleration level

Windows 5.x DirectSound subsystem uses each hardware acceleration feature only if a current maximum hardware acceleration level allows it. There are four acceleration levels: None, Basic, Standard and Full. Each next level allows DirectSound subsystem to utilize more of device/driver internal capabilities and process audio data more efficiently. So higher acceleration levels are better but they may cause some incompatibilities so Windows provides lower levels to achieve better compatibility.

A maximum allowed hardware acceleration level can be set to any of these four values for each DirectSound device independently. Applications using DirectSound interface can utilize no more acceleration features than the maximal device level allows.

A multistream feature is available only on a highest (Full) acceleration level. For each new device, maximal level is set to the Standard value. Therefore, to utilize all device capabilities, you must manually set it to the Full value.

You can change maximal acceleration level for VAC devices using Audio Properties applet. Open the Audio tab, select any Virtual Cable N device in Sound Playback listbox and click Advanced button. On the Advanced Audio Properties page, open Performance tab, select desired acceleration level and then click OK. On the Sounds and Audio Properties page, click Cancel (if you will click OK here, your default device will be changed).

Windows 6.x and higher implements no DirectSound hardware acceleration. All audio processing is performed by main CPU.

Working if channel mixing disabled

If channel mixing is disabled, hardware-accelerated playback may produce undesirable effects. For example, if you play a mono stream to a two-channel cable, DirectSound first creates a shared stereo stream with channel mask 3 (FL+FR), then creates a separate hardware-accelerated mono stream with channel mask 4 (FC). Since these masks don't overlap, VAC does not perform scatter/gather conversion and copies mono channel directly to cable's left channel.