SndVol如何更改给定音频会话的音量级别? [英] How is SndVol able to change the volume level of a given audio session?

查看:50
本文介绍了SndVol如何更改给定音频会话的音量级别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写自己的API,以执行SndVol系统实用程序的某些功能.我希望此API的一部分能够设置给定,但是我遇到了一个问题,尽管我可以使用 IAudioSessionControl 对象,但我需要 IAudioClient 对象以获取 ISimpleAudioVolume 对象,可以用来设置音频会话的音量级别.是否可以获取与 IAudioSessionControl 对象关联的 IAudioClient 对象?

解决方案

如果在IAudioSessionControl接口上调用QueryInterface,则通常可以访问ISimpleAudioVolume.

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

SndVol displays a slider on the "Device" panel that the user can use to change the master volume level of the audio device as well as a slider for each audio session (on the "Applications" panel) that changes the volume level of the session:

If I drag the slider handle for one of the audio sessions, then SndVol is able to change the audio session's volume level. How does it do that?

I thought that it was possible using Windows Vista's Core Audio API, but I encountered the problem that although I am able to iterate audio sessions of a device using an IAudioSessionEnumerator, the IAudioSessionEnumerator only gives me access to IAudioSessionControl objects, but I need the IAudioClient object to obtain an ISimpleAudioVolume object that I can use to set the audio session volume level. Is it possible to get the IAudioClient object associated with an IAudioSessionControl object?

解决方案

If you call QueryInterface on the IAudioSessionControl interface, you can often get access to an ISimpleAudioVolume.

这篇关于SndVol如何更改给定音频会话的音量级别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆