语音和语音识别之间的延迟

时间:2010-11-29 22:03:42

标签: android

我想在文本到语音和后续语音识别之间添加延迟但是对等待/睡眠语句以及不阻塞主线程的概念知之甚少。我是否可以提出如何实现等待,直到文本到语音结束讲话和语音识别开始。

                String myText1 = "Please speak the new speedlimit";
                mTts.speak(myText1, TextToSpeech.QUEUE_FLUSH, null);
                speechSucess = true;
                startVoiceRecognitionActivity();

1 个答案:

答案 0 :(得分:4)

设置OnUtteranceCompletedListener并从侦听器的回调函数中调用startVoiceRecognitionActivity();

http://developer.android.com/reference/android/speech/tts/TextToSpeech.html#setOnUtteranceCompletedListener(android.speech.tts.TextToSpeech.OnUtteranceCompletedListener