检测语音识别激活

发布于 2024-10-11 04:16:48 字数 367 浏览 8 评论 0原文

好吧,我有这个应用程序作为服务运行,经常采集音频样本,并跟踪幅度。它工作得很漂亮。我有 try/catch 块,这样我的应用程序就不会干扰使用麦克风的其他应用程序,等等。我遇到的唯一问题是语音识别应用程序。任何其他使用麦克风、录制备忘录、电话等的应用程序都不会因为 catch 块而打扰我的应用程序。但是,如果当我的应用程序尝试获取样本时语音识别应用程序正在运行,我的应用程序就会崩溃。据我所知,无论出于何种原因,我的应用程序在到达 stop() 函数时都会失败......但这不是我来这里的目的。

我想知道的是是否有一种方法可以检测语音识别应用程序是否正在运行/已启动。就像我说的,我有捕获块,当麦克风无法访问时,它们在其他情况下都能很好地工作,但由于某种原因,它们不适用于语音识别。

Alright, I have this app that runs as a service and takes audio samples every so often, and keeps track of the amplitude. It works beautifully. I have try/catch blocks so that my app doesn't interfere with other apps using the microphone, and all of that. The only problem I have is with the Voice Recognition app. Any other app that uses the microphone, recording memos, the phone, anything, doesn't bother my app because of the catch blocks. However, if the voice recognition app is running when my app tries to take its sample, my app crashes. To my knowledge, my app fails when it reaches the stop() function, for whatever reason...but that's not what I'm here for.

The thing I would like to know is if there is a way to detect if the Voice Recognition app is running/is started. Like I said, I have the catch blocks in place which work beautifully for every OTHER situation when the microphone wouldn't be accessible, but they, for some reason, don't work for the voice recognition.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文