如果我在模拟器上启动应用程序并按下按钮我可以听到声音,但如果它在真实设备上运行,我就听不到任何声音(音量大约为80%):
...
t1 = new TextToSpeech(getActivity().getApplicationContext(), new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if (status != TextToSpeech.ERROR) {
t1.setLanguage(Locale.UK);
Log.d("TTS", "ok");
} else {
Log.d("TTS", "error");
}
}
});
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
t1.speak("What is your name?", TextToSpeech.QUEUE_FLUSH, null);
}
});
...
根据LogCat中的输出,一切都很好,但如果我按下按钮,我听不到任何声音:
I/TextToSpeech: Sucessfully bound to com.google.android.tts
I/TextToSpeech: Connected to ComponentInfo{com.google.android.tts/com.google.android.tts.service.GoogleTTSService}
TTS: ok
可能是什么问题?仿真器API级别为4.2.2,设备 - 4.2.1。
root@android:/ # ls /system/tts/lang_pico/
de-DE_gl0_sg.bin
de-DE_ta.bin
en-GB_kh0_sg.bin
en-GB_ta.bin
en-US_lh0_sg.bin
en-US_ta.bin
es-ES_ta.bin
es-ES_zl0_sg.bin
fr-FR_nk0_sg.bin
fr-FR_ta.bin
it-IT_cm0_sg.bin
it-IT_ta.bin