[英]How to stream audio to a specific output device?
一直在努力寻找从文件或 web 到特定 output 设备的 stream 音频的方法,而不仅仅是默认设备。 尝试使用mciSendString
并且 打开命令确实接受设备 ID/文件名,但我还没有找到使用它的方法,甚至不确定这是否是我正在寻找的,但考虑到它说... or the filename of the device driver
猜测是(?),但如果我错了,请纠正我,这不是specify your output device
类型参数。
如果它是正确的,那么你如何枚举已安装的设备驱动程序,已经查看了IMMDevice
接口,因为它看起来像是可以将文件名存储在注册表中,但是 output 设备注册表项没有driver filename
类型值条目,或者至少我还没有找到一个。
So my question is, how would you go about streaming audio to a specific output device, it doesn't have to be done through mciSendString
, that's just something I looked into as it's one of the most talked about function when it comes to playing audio .
注意:请不要向我推荐像 NAudio 这样的 3rd 方库,我问这个问题的原因是没有得到对库的推荐,否则我已经使用过一个并且永远不会写这个,刚刚看到很多答案就像: Use {LibName}, it has what you want
的或类似的东西。
如果所写的内容奇怪或在某些地方措辞不正确,基本上这就是最终目标应该是:
Installed Output Devices:
- Output1
- Output2
- Output3
Method For Playing:
//will play x.mp3 through output device 1
PlayAudio(output: "Output1", mp3File: "x.mp3");
//will play x.mp3 through output device 2
PlayAudio(output: "Output2", mp3File: "x.mp3");
//will play x.mp3 through output device 3
PlayAudio(output: "Output3", mp3File: "x.mp3");
你好像在找这个 API: mciSendCommand()
要设置 Multimedia Control 使用的 WaveAudio 设备(声卡),您必须使用 mciSendCommand API。 多媒体控件不直接提供让您设置用于播放或录制的设备的方法。
MCI_SET
和MCI_WAVE_SET_PARMS
将 wOutput 设置为所需播放设备的 ID 调用mciSendCommand()
。mciGetDeviceID("waveaudio")
IDDevice
mciSendCommand(
) 的 IDDevice 它不是 100% 清楚wOutput
想要什么,它可能与waveOutGetDevCaps()
返回的 ID 相同
我只是个搬运工。
请参考:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.