Because the tts engine lacks pause and resume functions, I want to generate a wav file and play it with ExoPlayer.
The text is a bit long and the wav generation speed is a bit slow, I use the wait for method to wait for the end, but ExoPlayer cannot automatically play the wav file.
I need a way to wait for the end of the wav file generation, preferably with an end prompt, the next step is to automatically or manually play the wav file safely.
Thank you in advance!
Dim jo As JavaObject = tts1
Dim m As JavaObject
m.InitializeNewInstance("java.util.HashMap", Null)
jo.RunMethod("synthesizeToFile", Array(txtTTS.text, m, File.Combine(File.DirRootExternal, "1.wav")))
Sleep(1000) 'wait a little for the TTS to start so the below loop will properly "see" that it is talking
Do While jo.RunMethod("isSpeaking",Null) = True
Sleep(100)
Loop
Log("done speaking")
PlayTTS 'routine to play file
Dim jo As JavaObject = tts1
Dim m As JavaObject
m.InitializeNewInstance("java.util.HashMap", Null)
jo.RunMethod("synthesizeToFile", Array(txtTTS.text, m, File.Combine(File.DirRootExternal, "1.wav")))
Sleep(1000)
Do While jo.RunMethod("isSpeaking",Null) = True
Sleep(100)
Loop
Log("done speaking")
PlayTTS 'routine to play file