I need to implement feature in my Andorind app which allows to play two different synthesized languages in current Acitivity - for instance having two buttons Say English and Say French
I've tried to do it in two following ways but both of them works ineffectively because there is long delay before sound plays:
- first approach: create single instance of TTS and change language by setLocale method depending on what language has to be played. Unfortunately switching between languages by setLocale is time consuming which has impact on reaction after button is clicked
- second approach: create two instances of TTS each for respective language. Unfortunately delay occurs here as well and there is no difference between the first solution.
Can you please help to solve this annoying problem?
How about waiting for the two TTS engines to finish initialising at the start of your app, before any user interaction (do this by creating an OnInitListener and waiting -- e.g. with a semaphore -- until the onInit() method is called), so that by the time the user gets to the point in the app where the buttons are introduced, you have the two engines already initialised?