Audio Gain Classes (Windows Embedded CE 6.0)

1/6/2010

The traditional approach to managing multiple audio sources is to either mix them all, or to allow audio streams to be associated with window handles. The latter approach allows applications to only play audio when their window is in the foreground.

Audio gain classes offer a different stream management model. By using audio gain classes, you can classify audio sources and then rely on the OS to manage how these classes can preempt one another. For example, to ensure that the user knows about an incoming call, a phone-enabled device being used as a media player should attenuate the playback audio when the phone rings.

The total gain for a waveform audio streams is composed of three components. The following table shows these components.

Component Description

Stream gain

A gain value associated with a specific audio stream. You can set this gain by passing a stream handle in a call to waveOutSetVolume.

Device gain

A gain that is uniformly applied to all streams on a device. You can set this gain by passing a device index in a call to waveOutSetVolume.

Class gain

A gain applied to a group of audio streams that have similar roles on the device.

Each component of the total gain is used to achieve a different effect. Stream and device gains provide very direct and proactive means of controlling gain. You can use stream gains to balance the relative volumes for individual streams on a device. The device gain provides a master volume control for the device.

Class gain provides a more indirect means of controlling gain. By assigning audio gain classes to your audio streams, your audio streams will inherit the gain settings for their respective classes. This allows you to affect the gain of multiple streams simultaneously. More importantly, it allows you to select a group of streams and affect their gain without having details about the contents of the streams.

When streams are created, they are assigned to the WAGC_CLASS_NORMAL gain class. You can assign a stream to different class by calling waveOutSetProperty (or waveInSetProperty for input streams). You can determine a stream's audio gain class by calling waveOutGetProperty (or waveInGetProperty for input streams).

See Also

Concepts

Using the Waveform Audio Interface