Поделиться через


IChannelAudioVolume Interface

Previous Next

IChannelAudioVolume Interface

The IChannelAudioVolume interface enables a client to control and monitor the volume levels for all of the channels in the audio session that the stream belongs to. This is the session that the client assigned the stream to during the call to the IAudioClient::Initialize method. The client obtains a reference to the IChannelAudioVolume interface on a stream object by calling the IAudioClient::GetService method with parameter riid set to REFIID IID_IChannelAudioVolume.

The effective volume level of any channel in the session submix, as heard at the speakers, is the product of the following four volume-level factors:

  • The per-channel volume levels of the streams in the session, which clients can control through the methods in the IAudioStreamVolume interface.
  • The per-channel volume level of the session, which clients can control through the methods in the IChannelAudioVolume interface.
  • The master volume level of the session, which clients can control through the methods in the ISimpleAudioVolume interface.
  • The policy-based volume level of the session, which the system dynamically assigns to the session as the global mix changes.

Each of the four volume-level factors in the preceding list is a value in the range 0.0 to 1.0, where 0.0 indicates silence and 1.0 indicates full volume (no attenuation). The effective volume level is also a value in the range 0.0 to 1.0.

Typical audio applications do not modify the volume levels of sessions. Instead, they rely on users to set these volume levels through the Sndvol program. Sndvol modifies only the master volume levels of sessions. By default, the session manager sets the per-channel volume levels to 1.0 at the initial activation of a session. Subsequent per-channel volume changes by clients are persistent across computer restarts.

When releasing an IChannelAudioVolume interface instance, the client must call the interface's Release method from the same thread as the call to IAudioClient::GetService that created the object.

The IChannelAudioVolume interface controls the channel volumes in an audio session. An audio session is a collection of shared-mode streams. This interface does not work with exclusive-mode streams. For information about volume controls for exclusive-mode streams, see EndpointVolume API.

IChannelAudioVolume inherits from the IUnknown interface. In addition to the methods inherited from IUnknown, IChannelAudioVolume supports the following methods.

Method Description
GetAllVolumes Retrieves the volume levels for all the channels in the session.
GetChannelCount Retrieves the number of channels contained in the session.
GetChannelVolume Retrieves the volume level for the specified channel in the session.
SetAllVolumes Sets the individual volume levels for all the channels in the session.
SetChannelVolume Sets the volume level for the specified channel in the session.

Requirements

Client: Windows Vista

Header: Include Audioclient.h.

See Also

Previous Next