gpt4 book ai didi

c++ - mciSendString() 设置音频音量错误 261

转载 作者:行者123 更新时间:2023-11-30 05:47:34 29 4
gpt4 key购买 nike

我正在使用 MCI 做一些与声音相关的事情,一切正常,除了我不能改变音量。我有以下代码:

mciSendStringA("open res/theme.wav type waveaudio alias maintheme", nullptr, 0, nullptr);
MCIERROR error = mciSendStringA("setaudio maintheme volume to 50", nullptr, 0, nullptr);

error 为 261。程序运行正常,但音量没有变化。有什么问题的建议吗? (两页谷歌搜索,什么也没有)

最佳答案

根据文档:

setaudio command

The setaudio command sets values associated with audio playback and capture. Digital-video and VCR devices recognize this command.

...

lpszAudio
Flag for audio playback and capture. The following table lists device types that recognize the setaudio command and the flags used by each type.

digitalvideo
vcr

您的音频播放使用的是 waveaudio 设备,该设备不支持 setaudio 命令。

为了设置音频播放的音量,您必须切换到WaveOut API 进行播放,然后您可以使用waveOutSetVolume()。 .

关于c++ - mciSendString() 设置音频音量错误 261,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28522150/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com