C++ Winapi waveOutSetVolume()

标签 c++ winapi audio waveout

我想用该功能更改主音量

MMRESULT waveOutSetVolume(
  HWAVEOUT hwo, 
  DWORD dwVolume 
); 

hwo
Handle to an open waveform-audio output device. This parameter can also be a device identifier. 

如何为主卷创建处理程序?

dwVolume
Specifies a new volume setting. The low-order word contains the left-channel volume setting, and the high-order word contains the right-channel setting. A value of 0xFFFF represents full volume, and a value of 0x0000 is silence.
If a device does not support both left and right volume control, the low-order word of dwVolume specifies the volume level, and the high-order word is ignored.

如何将音量(例如 75)传递给函数?

像这样尝试:How to change master volume programmatically?对我不起作用!

最佳答案

在 Vista+ 中,无法通过旧版 waveOutXxx API 更改主音量。使用 WASAPI 代替:

If a device has a hardware volume control, changes made to the control through the IAudioEndpointVolume interface affect the volume level both in shared mode and in exclusive mode. If a device lacks hardware volume and mute controls, changes made to the software volume and mute controls through this interface affect the volume level in shared mode, but not in exclusive mode. In exclusive mode, the application and the audio hardware exchange audio data directly, bypassing the software controls.

关于C++ Winapi waveOutSetVolume(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21075539/

相关文章:

windows - GetMessage 是否需要 GUI

c - 选项卡中的元素 WinAPI

actionscript-3 - 自定义函数的原型(prototype)函数

matlab - Matlab音频格式-如何处理?

c# - 查找流(mp3)信息(持续时间,比特率)

c++ - 创建多个对象的链表

c++ - 编译时通过索引访问类模板的成员

c++ - 链接器脚本 - 在内存区域的末尾放置一个节

c++ - 如何让一个方法访问其他模板类实例的私有(private)成员?

c++ - RAS API。 sizeof(RASDIALPARAMS) 是错误的。错误 632