2014-01-12 71 views
1

我想改变主音量与功能C++ WINAPI waveOutSetVolume()

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?不适合我!

回答

2

在Vista +到传统waveOutXxx API中没有主音量更改。使用WASAPI代替:

如果设备有一个硬件音量控制,通过IAudioEndpointVolume接口到控制 做出变化影响音量 两在共享模式和独占模式下。如果设备缺少硬件 音量和静音控制,则通过此接口对软件音量和静音 控件所做的更改会影响共享 模式中的音量级别,但不会影响独占模式。在独占模式下,应用程序 和音频硬件直接交换音频数据,绕过 软件控制。

+0

谢谢,但WASAPI包含一个函数,只需要卷和处理程序作为输入,如WINAPI函数? –

+0

这不是一个单一的功能。我将相关的MSDN页面链接成为您的主角。 –

+0

好吧谢谢,我会用它! –