[英]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.