SndVol 如何能够更改给定音频会话的音量级别?
我正在编写自己的 API 来执行 SndVol 系统实用程序的一些功能。我希望此 API 的一部分能够设置给定 的音量级别音频会话。
SndVol 在“设备”面板上显示一个滑块,用户可以使用该滑块更改音频设备的主音量级别,并为每个音频会话(在“应用程序”面板上)显示一个更改会话音量级别的滑块:
如果我拖动其中一个音频会话的滑块手柄,则 SndVol 能够更改音频会话的音量级别。它是如何做到的?
我认为可以使用 Windows Vista 的 Core Audio API,但我遇到了一个问题,虽然我能够使用 IAudioSessionEnumerator
,IAudioSessionEnumerator
只允许我访问 IAudioSessionControl
对象,但我需要 IAudioClient
对象获取 ISimpleAudioVolume
对象,我可以使用它来设置音频会话音量级别。是否可以获取与 IAudioSessionControl
对象关联的 IAudioClient
对象?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您在 IAudioSessionControl 接口上调用 QueryInterface,则通常可以访问 ISimpleAudioVolume。
If you call QueryInterface on the IAudioSessionControl interface, you can often get access to an ISimpleAudioVolume.
Larry Osterman,他在 Microsoft 工作,致力于新的音频 API 的工作,编写了一系列有关新的 Vista/Win7 音频功能的博客文章。以下是一些可能有帮助的链接:
快速浏览新的 Windows 7 多媒体/音频 SDK 示例 - 示例显示每个应用程序的音量控制
Vista 中的音量控制 - 描述每个应用程序Vista/Win7中添加的音量控制和其他新音频功能
页面右侧有索引;您可以查看 音频 标记的项目,了解一些其他文章,这些文章可能会帮助。
Larry Osterman, who works for Microsoft and worked on the new audio API stuff, wrote a series of blog posts about the new Vista/Win7 audio features. Here are a few links that might help:
A Quick Run-through the new Windows 7 Multimedia/Audio SDK Samples - Sample shows per-app volume control
Volume Control in Vista - Describes per-application volume control and other new audio features that were added in Vista/Win7
There's an index on the right side of the page; you can look at the Audio tagged items for some other articles that might help.