How can SndVol change the volume level of a given audio session?

I am writing my own API to perform some of the functions of the SndVol system utility. I would like part of this API to be able to set the volume level of this audio session .

SndVol displays a slider in the Device panel, which the user can use to change the volume level of the main audio device, as well as a slider for each audio session (in the Applications panel), which changes the session volume level:

Screenshot of SndVol Volume Mixer

If I dragged the slider handle for one of the audio sessions, then SndVol will be able to change the volume level of the audio session. How it's done?

I thought this was possible using the Windows Vista Core Audio API , but I ran into the problem that although I can repeat the sessions of an audio device using IAudioSessionEnumerator , IAudioSessionEnumerator gives me access to IAudioSessionControl , but I need an IAudioClient object to get ISimpleAudioVolume , which I can use to set the audio session volume level. Is it possible to get the IAudioClient object associated with the IAudioSessionControl object?

+7
source share
2 answers

If you call QueryInterface in the IAudioSessionControl interface, you can often access ISimpleAudioVolume.

+10
source

Larry Osterman , who works at Microsoft and worked on new audio API material, wrote a series of blog posts about the new Vista / Win7 audio. Here are some links that might help:

Quickly Launch New Multimedia / Audio SDK Samples for Windows 7 - Example Shows Volume Control for Each Application

Vista Volume Control - Describes the volume control for each application and other new audio features that have been added in Vista / Win7

There is a pointer on the right side of the page; You can see the Audio tags for some other articles that may help.

+2
source

All Articles