【问题标题】:C++ Winapi waveOutSetVolume()C++ Winapi WaveOutSetVolume()
【发布时间】:2014-01-31 06:27:37
【问题描述】:

我想用函数改变主音量

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

【问题讨论】:

    标签: c++ winapi audio waveout


    【解决方案1】:

    Vista+ 中没有通过旧版waveOutXxx API 更改主卷。改用 WASAPI:

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

    【讨论】:

    • 谢谢,但是 WASAPI 是否包含只需要音量和处理程序作为输入的函数,例如 WINAPI 函数?
    • 这不是一个单一的功能。我链接了相关的 MSDN 页面作为您的线索。
    猜你喜欢
    • 2011-07-13
    • 2013-03-22
    • 2013-03-19
    • 1970-01-01
    • 1970-01-01
    • 2010-09-30
    • 2014-06-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多