【发布时间】:2013-04-23 07:11:33
【问题描述】:
我在我的 Activity 中定义了这个简单的方法:
private void playSound(final boolean ttsOn) {
// TODO Auto-generated method stub
int water = 0;
SoundPool pl;
pl = new SoundPool(5, AudioManager.STREAM_MUSIC, 0);
water = pl.load(this, R.raw.water_boiling, 0);
pl.setOnLoadCompleteListener(new OnLoadCompleteListener() {
@Override
public void onLoadComplete(SoundPool soundPool, int sampleId, int status) {
// TODO Auto-generated method stub
soundPool.play(sampleId, 1f, 1f, 0, 0, 1);
if(ttsOn)
speakOut();
}
});
speakOut() 在哪里:
private void speakOut() {
tts.setLanguage(Locale.ITALIAN);
tts.speak(n.Message, TextToSpeech.QUEUE_FLUSH, null);
}
但这会重现我的 mp3 文件和我的 tts 同时说话。
所以问题是:
如何在我的 mp3 之后重现 tts?
【问题讨论】:
-
我从来没有用过这个,但也许就是这样。你能添加 if 条件 status == 0 developer.android.com/reference/android/media/…
标签: android multithreading text-to-speech