在 Windows 中检测耳机
我正在尝试在 Windows 上检测耳机是否已插入。我已经尝试过 DirectSound 和 NAudio 库,但没有取得任何成功。有人有什么建议吗?
注意:此问题与此问题重复,但答案该问题不包含任何代码示例或教程。
I'm trying to detect if the headphones are plugged in on Windows. I've already tried DirectSound and the NAudio library and have not had any success. Does anyone have any suggestions?
NOTE: this question is a duplicate of this question, but the answer to that question didn't contain any code samples or tutorials.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所以......我想我可能会发现一些非常晦涩的东西......
你们中的任何人都可以检查这是否有效吗? - 您必须引用 NAudio 库。
此属性返回 1(已插入)或 0(拔掉插头).. 它对我来说真的很好用..
更新:刚刚在 CodePlex - iTunesHead
So...I think I might found something REALY obscure..
Can any of you guys check if that works? - You MUST have the NAudio library referenced..
This property return's 1 (Plugged) or 0 (Unplugged).. and It's working realy good for me..
UPDATE: Just published the app on CodePlex - iTunesHead
Microsoft.DirectX.DirectSound.Speakers 怎么样?
What about Microsoft.DirectX.DirectSound.Speakers?