C ++ Winapi waveOutSetVolume()

时间:2014-01-12 14:03:50

标签: 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?对我不起作用!

1 个答案:

答案 0 :(得分:2)

Vista +中通过旧版waveOutXxx API无法更改主量。请改用WASAPI:

  

如果设备具有硬件音量控制,则对控件进行更改   通过IAudioEndpointVolume界面影响音量级别   在共享模式和独占模式下。如果设备缺少硬件   音量和静音控制,对软件音量和静音的更改   通过此接口控制会影响共享中的音量级别   模式,但不是独占模式。在独占模式下,应用程序   和音频硬件直接交换音频数据,绕过   软件控制。