次の方法で共有


ISimpleAudioVolume Interface

Previous Next

ISimpleAudioVolume Interface

The ISimpleAudioVolume interface enables a client to control the master volume level of an audio session. The IAudioClient::Initialize method initializes a stream object and assigns the stream to an audio session. The client obtains a reference to the ISimpleAudioVolume interface on a stream object by calling the IAudioClient::GetService method with parameter riid set to REFIID IID_ISimpleAudioVolume.

Alternatively, a client can obtain the ISimpleAudioVolume interface of an existing session without having to first create a stream object and add the stream to the session. Instead, the client calls the IAudioSessionManager::GetSimpleAudioVolume method with the session GUID.

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 master volume level of the session, which clients can control through the methods in the ISimpleAudioVolume interface.
  • The per-channel volume level of the session, which clients can control through the methods in the IChannelAudioVolume 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 master volume level to 1.0 at the initial activation of a session. Subsequent volume changes by Sndvol or other clients are persistent across computer restarts.

When releasing an ISimpleAudioVolume 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 ISimpleAudioVolume interface controls the volume of 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.

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

Method Description
GetMasterVolume Retrieves the client volume level for the audio session.
GetMute Retrieves the current muting state for the audio session.
SetMasterVolume Sets the master volume level for the audio session.
SetMute Sets the muting state for the audio session.

Requirements

Client: Windows Vista

Header: Include Audioclient.h.

See Also

Previous Next