diff options
author | Charles Chen <clchen@google.com> | 2010-01-07 18:56:24 -0800 |
---|---|---|
committer | Charles Chen <clchen@google.com> | 2010-01-08 15:06:57 -0800 |
commit | 60dd360640a400d9b4a602160733281d284aaee5 (patch) | |
tree | 97ebd5699d2f324fc8215c6714ddd3e5e6771997 /packages/TtsService/src | |
parent | 6414970ac7dc629345942059f75362d894c2310e (diff) | |
download | frameworks_base-60dd360640a400d9b4a602160733281d284aaee5.zip frameworks_base-60dd360640a400d9b4a602160733281d284aaee5.tar.gz frameworks_base-60dd360640a400d9b4a602160733281d284aaee5.tar.bz2 |
Enabling multiple apps to use different speech synthesis engines and not
interfere with one another.
Diffstat (limited to 'packages/TtsService/src')
-rwxr-xr-x | packages/TtsService/src/android/tts/TtsService.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/TtsService/src/android/tts/TtsService.java b/packages/TtsService/src/android/tts/TtsService.java index 23365c9..1efa5a3 100755 --- a/packages/TtsService/src/android/tts/TtsService.java +++ b/packages/TtsService/src/android/tts/TtsService.java @@ -744,6 +744,7 @@ public class TtsService extends Service implements OnCompletionListener { String country = ""; String variant = ""; String speechRate = ""; + String engine = ""; if (speechItem.mParams != null){ for (int i = 0; i < speechItem.mParams.size() - 1; i = i + 2){ String param = speechItem.mParams.get(i); @@ -765,12 +766,17 @@ public class TtsService extends Service implements OnCompletionListener { } catch (NumberFormatException e) { streamType = DEFAULT_STREAM_TYPE; } + } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_ENGINE)) { + engine = speechItem.mParams.get(i + 1); } } } } // Only do the synthesis if it has not been killed by a subsequent utterance. if (mKillList.get(speechItem) == null) { + if (engine.length() > 0) { + setEngine(engine); + } if (language.length() > 0){ setLanguage("", language, country, variant); } @@ -825,6 +831,7 @@ public class TtsService extends Service implements OnCompletionListener { String country = ""; String variant = ""; String speechRate = ""; + String engine = ""; if (speechItem.mParams != null){ for (int i = 0; i < speechItem.mParams.size() - 1; i = i + 2){ String param = speechItem.mParams.get(i); @@ -839,12 +846,17 @@ public class TtsService extends Service implements OnCompletionListener { variant = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID)){ utteranceId = speechItem.mParams.get(i+1); + } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_ENGINE)) { + engine = speechItem.mParams.get(i + 1); } } } } // Only do the synthesis if it has not been killed by a subsequent utterance. if (mKillList.get(speechItem) == null){ + if (engine.length() > 0) { + setEngine(engine); + } if (language.length() > 0){ setLanguage("", language, country, variant); } |