.NET 中是否有默认音频输入更改时的事件?
我在 Windows 7 中使用 System.Speech.Recognition 来让用户通过语音命令控制程序。识别码已集成到程序本身中。现在,识别引擎在程序启动时创建,并在用户更改语音识别语言时重新创建。这一切都很好。
最近我们在识别引擎的创建方面遇到了问题。如果系统默认音频输入在程序运行期间发生变化,我们将无法响应。具体来说,如果程序启动时麦克风被拔掉,识别引擎将无法找到输入。我进入了残疾状态。如果稍后插入麦克风,我希望程序注意到这一点并更新引擎。
当系统默认音频输入发生变化时是否有暴露的事件?
I'm using System.Speech.Recognition
in Windows 7 to let the user control a program by voice commands. The recognition code is integrated into the program itself. Now, the recognition engine is created at program startup and recreated if the user changes the voice recognition language. This all works fine.
Recently we had an issue with the creation of the recognition engine. If the system default audio input changes during program run we have no way of responding to it. Specifically, if the mike was unplugged when the program started the recognition engine would not be able to find an input. I goes into a disabled state. If later the mike is plugged in I would like the program to notice this and update the engine.
Is there an exposed event for when the system default audio input changes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要实现 IMMNotificationClient,并且调用 IMMDeviceEnumerator::RegisterEndpointNotificationCallback。 NAudio 人员为此提供了一个 C# 包装器;我会看看。
You need to implement IMMNotificationClient, and call IMMDeviceEnumerator::RegisterEndpointNotificationCallback. The NAudio guys have a C# wrapper for this; I'd look at it.