并RecognitionListener为什么要停止在软糖工作? [英] Why did RecognitionListener stop working in JellyBean?

查看:188
本文介绍了并RecognitionListener为什么要停止在软糖工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关每个人使用Android的语音识别API ,也曾经是一个方便的<一个href="http://developer.android.com/reference/android/speech/RecognitionListener.html#onBufferReceived%28byte%5B%5D%29">RecognitionListener你可以注册,将推动各种活动,以您的回调。具体地,有以下<一href="http://developer.android.com/reference/android/speech/RecognitionListener.html#onBufferReceived%28byte%5B%5D%29"><$c$c>onBufferReceived(byte[])方法:

For everyone using Android's voice recognition API, there used to be a handy RecognitionListener you could register that would push various events to your callbacks. In particular, there was the following onBufferReceived(byte[]) method:

公共抽象无效onBufferReceived(byte []的缓冲区)

自:API级别8 的更多声音已收到。这样做的目的   功能是允许对有关的用户提供反馈   捕获的音频。谁也不能保证,这种方法将被调用。

Since: API Level 8 More sound has been received. The purpose of this function is to allow giving feedback to the user regarding the captured audio. There is no guarantee that this method will be called.

参数 缓存含大端16位序列缓冲区   整数重新presenting单个信道音频流。采样率   依赖于实现。

Parameters buffer a buffer containing a sequence of big-endian 16-bit integers representing a single channel audio stream. The sample rate is implementation dependent.

尽管法明确规定,没有任何的保证的它会被调用,ICS和之前它将有效地被称为100%的时间:经常不够,至少,通过连接所有收到这样的字节数,你可以重建整个音频流播放。

Although the method explicitly states that there is no guarantee it will be called, in ICS and prior it would effectively be called 100% of the time: regularly enough, at least, that by concatenating all the bytes received this way, you could reconstruct the entire audio stream and play it back.

由于某些原因,然而,在杰利贝恩SDK,这个神奇地停止工作。还有的去precation没有通知和code仍在汇总,但 onBufferReceived 是现在的从来没有调用。从技术上讲这不是打破了他们的API(因为它说,有不保证的方法将被调用),但显然这是一个重大更改了很多东西,依赖于这种行为。

For some reason, however, in the Jellybean SDK, this magically stopped working. There's no notice of deprecation and the code still compiles, but the onBufferReceived is now never called. Technically this isn't breaking their API (since it says there's "no guarantee" the method will be called), but clearly this is a breaking change for a lot of things that depended on this behaviour.

有谁知道为什么这个功能是禁用的,如果有一种方法来复制其在杰利贝恩行为?

Does anybody know why this functionality was disabled, and if there's a way to replicate its behaviour on Jellybean?

澄清:我知道,整个 RecognizerIntent 的事情是与多个实现(包括一些可在Play商店),和一个接口他们每个人都能选择做什么用 RecognitionListener 。我特别指的是默认的谷歌实现,杰利贝恩手机绝大多数使用。

Clarification: I realize that the whole RecognizerIntent thing is an interface with multiple implementations (including some available on the Play Store), and that they can each choose what to do with RecognitionListener. I am specifically referring to the default Google implementation that the vast majority of Jellybean phones use.

推荐答案

谷歌不会调用此方法的果冻豆语音应用程序(QuickSearchBox)。它根本就不在code。除非有来自谷歌工程师的官方评论,我不能给为什么他们这样做了肯定的答案。我做搜索开发者论坛,但没有看到对这一决定的任何评论。

Google does not call this method their Jelly Bean speech app (QuickSearchBox). Its simply not in the code. Unless there is an official comment from a Google Engineer I cannot give a definite answer "why" they did this. I did search the developer forums but did not see any commentary about this decision.

ICS的默认语音识别来自谷歌的VoiceSearch.apk。你可以反编译这个apk文件,看看,发现看到有一个活动来处理动作的意图* android.speech.action.RECOGNIZE_SPEECH *。在这个APK我搜索onBufferReceived,并发现了一个引用它的 com.google.android.voicesearch.GoogleRecognitionService $ RecognitionCallback 的。

The ics default for speech recognition comes from Google's VoiceSearch.apk. You can decompile this apk and see and find see there is an Activity to handle an intent of action *android.speech.action.RECOGNIZE_SPEECH*. In this apk I searched for "onBufferReceived" and found a reference to it in com.google.android.voicesearch.GoogleRecognitionService$RecognitionCallback.

使用果冻豆,谷歌重新命名VoiceSearch.apk到QuickSearch.apk,并提出了很多新增加的应用程序(例如离线听写)。你会希望仍然找到一个onBufferReceived电话,但由于某种原因,它是完全消失了。

With Jelly Bean, Google renamed VoiceSearch.apk to QuickSearch.apk and made a lot of new additions to the app (ex. offline dictation). You would expect to still find an onBufferReceived call, but for some reason it is completely gone.

这篇关于并RecognitionListener为什么要停止在软糖工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆