Sound Driver Technology

Describes the technology concepts that are used in the Sound Driver.

Audio hardware device

An audio hardware device is an individual hardware codec device together with any associated controller hardware that allows the CPU to communicate with it.

A basic audio hardware device typically provides two communication paths: an input path for the audio recording and an output path for audio playback.

Most basic audio hardware devices support full duplex data transfer although some are only half-duplex or maybe just simplex. Each input or output path may be used to transfer mono data or stereo data. In the case of stereo this consists of two audio channels, the left and the right; mono data consists of just a single audio channel.

A more complex audio hardware device could be an AC 97 codec or similar, plus its associated controller, which can support multiple input and output paths. Each input or output path may be used to transfer mono data, stereo data or 'multichannel data'. For example, left, right, centre, left and right surround and Low-Frequency Effects (LFE).

Unit

Units are used to provide access to the various audio hardware devices. Each unit supports just one communication path this is either input or output.

Clients of the audio hardware system can open a separate connection to each unit. The mapping between the units on a given phone and the audio hardware devices themselves is platform specific; this is determined by the implementer of the Sound Driver PDD for that platform.

A basic full-duplex audio hardware device is presented as two units, one input/record unit and one output/playback unit. A more complex audio hardware device such as an AC 97 codec may be represented to the rest of the OS as a number of audio input and output units.

Audio channel

An audio channel is a data stream between a client and an audio unit. There are one or more audio channels per driver channel.

Driver channel

A driver channel is a session between a client and an audio unit. A client may have driver channels open on more than one unit.

Note: The difference between a driver channel and an audio channel. A driver channel is a session between the client and an audio device which can consist of one or more audio channels. An audio channel refers to the audio stream, for example, left or right output.
Figure 1. The relationship between audio channels and device channels.

Mono to stereo conversion

Many codecs that support stereo playback can only accept audio data that is delivered with the samples for each of the channels interleaved, for example, LRLRLR. For these audio hardware devices, in order to operate the channel in mono mode and to play audio data which contains only samples for a single channel it is necessary to perform mono-to-stereo conversion on the audio data before delivering it to the codec. So, for a section of mono audio data that contains three samples, lets call them S1, S2 and S3, each sample is duplicated, so we have S1,S1,S2,S2,S3,S3, with identical samples being delivered to each channel.

Unfortunately, the only way for the PDD to implement this conversion is for it to allocate a conversion buffer and to copy each sample twice into this buffer. The PDD has to allocate a separate conversion buffer for each simultaneous transfer operation it supports, for example, for the template playback driver, a conversion buffer count equal to KTemplateMaxTxDmaRequests.

When performing conversion in this manner, the maximum transfer size that the PDD can accept from the LDD becomes half the size of each conversion buffer, and when configured in this mode, the value returned to the LDD in response to DSoundScPdd::MaxTransferLen must equal this value.

Likewise, the record data may be delivered by the audio hardware device only in stereo format with the data samples for each channel interleaved. If the driver channel is configured in mono record mode, stereo to mono conversion has to be performed in the PDD to discard each alternate sample.