Android TTS回调:已完成对1的调度
我创建了一个小型TTS应用程序,实现了ONutternanceCompleteListener,虽然事情似乎完全按照预期运行,但我在LogCat上注意到了以下内容(每个完成的话语对应一个): 03-01 20:47:06.436: 详细/TTS服务(381):TTS回调: 发送完成至1 同样,这似乎是良性的,但我不明白“1”是什么意思。所有语句的所有这些行都表示“已完成到1”,即使对于大于1的语句ID也是如此 “1”在此日志中是什么意思 顺便说一句,此消息不是由我的代码生成的,而是由TTS引擎(Pico)本身生成的。查看位于的源代码,您可以找到函数DispatchertanceCompletedCallback():Android TTS回调:已完成对1的调度,android,text-to-speech,Android,Text To Speech,我创建了一个小型TTS应用程序,实现了ONutternanceCompleteListener,虽然事情似乎完全按照预期运行,但我在LogCat上注意到了以下内容(每个完成的话语对应一个): 03-01 20:47:06.436: 详细/TTS服务(381):TTS回调: 发送完成至1 同样,这似乎是良性的,但我不明白“1”是什么意思。所有语句的所有这些行都表示“已完成到1”,即使对于大于1的语句ID也是如此 “1”在此日志中是什么意思 顺便说一句,此消息不是由我的代码生成的,而是由TTS引擎(
private void dispatchUtteranceCompletedCallback(String utteranceId, String packageName) {
/* Legacy support for TTS */
final int oldN = mCallbacksOld.beginBroadcast();
for (int i = 0; i < oldN; i++) {
try {
mCallbacksOld.getBroadcastItem(i).markReached("");
} catch (RemoteException e) {
// The RemoteCallbackList will take care of removing
// the dead object for us.
}
}
try {
mCallbacksOld.finishBroadcast();
} catch (IllegalStateException e) {
// May get an illegal state exception here if there is only
// one app running and it is trying to quit on completion.
// This is the exact scenario triggered by MakeBagel
return;
}
/* End of legacy support for TTS */
ITtsCallbackBeta cb = mCallbacksMap.get(packageName);
if (cb == null) {
return;
}
Log.v(SERVICE_TAG, "TTS callback: dispatch started");
// Broadcast to all clients the new value.
final int N = mCallbacks.beginBroadcast();
try {
cb.utteranceCompleted(utteranceId);
} catch (RemoteException e) {
// The RemoteCallbackList will take care of removing
// the dead object for us.
}
mCallbacks.finishBroadcast();
Log.v(SERVICE_TAG, "TTS callback: dispatch completed to " + N);
}
private void dispatcheutrancecompletedcallback(字符串outtanceid,字符串packageName){
/*对TTS的传统支持*/
final int oldN=mCallbacksOld.beginBroadcast();
对于(int i=0;i
1是N的当前值,由mCallbacks.beginBroadcast()的返回值初始化
是该类的一个方法,其文档说明:
返回中的回调次数
广播,用于
getBroadcastItem(int)来确定
您可以提供的索引范围
这有帮助吗?查看上提供的源代码,您可以找到函数DispatcheutranceCompletedCallback():
private void dispatchUtteranceCompletedCallback(String utteranceId, String packageName) {
/* Legacy support for TTS */
final int oldN = mCallbacksOld.beginBroadcast();
for (int i = 0; i < oldN; i++) {
try {
mCallbacksOld.getBroadcastItem(i).markReached("");
} catch (RemoteException e) {
// The RemoteCallbackList will take care of removing
// the dead object for us.
}
}
try {
mCallbacksOld.finishBroadcast();
} catch (IllegalStateException e) {
// May get an illegal state exception here if there is only
// one app running and it is trying to quit on completion.
// This is the exact scenario triggered by MakeBagel
return;
}
/* End of legacy support for TTS */
ITtsCallbackBeta cb = mCallbacksMap.get(packageName);
if (cb == null) {
return;
}
Log.v(SERVICE_TAG, "TTS callback: dispatch started");
// Broadcast to all clients the new value.
final int N = mCallbacks.beginBroadcast();
try {
cb.utteranceCompleted(utteranceId);
} catch (RemoteException e) {
// The RemoteCallbackList will take care of removing
// the dead object for us.
}
mCallbacks.finishBroadcast();
Log.v(SERVICE_TAG, "TTS callback: dispatch completed to " + N);
}
private void dispatcheutrancecompletedcallback(字符串outtanceid,字符串packageName){
/*对TTS的传统支持*/
final int oldN=mCallbacksOld.beginBroadcast();
对于(int i=0;i
1是N的当前值,由mCallbacks.beginBroadcast()的返回值初始化
是该类的一个方法,其文档说明:
返回中的回调次数
广播,用于
getBroadcastItem(int)来确定
您可以提供的索引范围
这有用吗