I define this simple method in my 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();
}
});
Where speakOut()
is this:
private void speakOut() {
tts.setLanguage(Locale.ITALIAN);
tts.speak(n.Message, TextToSpeech.QUEUE_FLUSH, null);
}
But this reproduce my mp3 file and my tts speak at same time.
So the question is:
How can I reproduce tts after my mp3?