diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-17 21:39:26 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-17 21:39:26 -0700 |
commit | 4b897aa99bf71f933f5b202c1531858382122d6f (patch) | |
tree | 5d06b649f0a0ddeea7a8e038c32f3e92e00d89ef /packages/TtsService | |
parent | 39846e691976fa7335bf5e648de46268d24b9927 (diff) | |
parent | b79370aad730949543bccf01b2c3d9ed64f493f5 (diff) | |
download | frameworks_base-4b897aa99bf71f933f5b202c1531858382122d6f.zip frameworks_base-4b897aa99bf71f933f5b202c1531858382122d6f.tar.gz frameworks_base-4b897aa99bf71f933f5b202c1531858382122d6f.tar.bz2 |
Merge change 7829 into donut
* changes:
Making sure that there are no calls made to the native TTS layer if the utterance is in the process of being canceled.
Diffstat (limited to 'packages/TtsService')
-rwxr-xr-x | packages/TtsService/src/android/tts/TtsService.java | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/packages/TtsService/src/android/tts/TtsService.java b/packages/TtsService/src/android/tts/TtsService.java index b3b580c..28801f8 100755 --- a/packages/TtsService/src/android/tts/TtsService.java +++ b/packages/TtsService/src/android/tts/TtsService.java @@ -551,16 +551,16 @@ public class TtsService extends Service implements OnCompletionListener { return; } int streamType = DEFAULT_STREAM_TYPE; + String language = ""; + String country = ""; + String variant = ""; + String speechRate = ""; if (speechItem.mParams != null){ - String language = ""; - String country = ""; - String variant = ""; for (int i = 0; i < speechItem.mParams.size() - 1; i = i + 2){ String param = speechItem.mParams.get(i); if (param != null) { if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_RATE)) { - setSpeechRate("", - Integer.parseInt(speechItem.mParams.get(i+1))); + speechRate = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_LANGUAGE)){ language = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_COUNTRY)){ @@ -579,12 +579,15 @@ public class TtsService extends Service implements OnCompletionListener { } } } + } + // Only do the synthesis if it has not been killed by a subsequent utterance. + if (mKillList.get(speechItem) == null) { if (language.length() > 0){ setLanguage("", language, country, variant); } - } - // Only do the synthesis if it has not been killed by a subsequent utterance. - if (mKillList.get(speechItem) == null){ + if (speechRate.length() > 0){ + setSpeechRate("", Integer.parseInt(speechRate)); + } nativeSynth.speak(speechItem.mText, streamType); } } catch (InterruptedException e) { @@ -624,16 +627,16 @@ public class TtsService extends Service implements OnCompletionListener { synth.start(); return; } + String language = ""; + String country = ""; + String variant = ""; + String speechRate = ""; if (speechItem.mParams != null){ - String language = ""; - String country = ""; - String variant = ""; for (int i = 0; i < speechItem.mParams.size() - 1; i = i + 2){ String param = speechItem.mParams.get(i); - if (param != null){ - if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_RATE)){ - setSpeechRate("", - Integer.parseInt(speechItem.mParams.get(i+1))); + if (param != null) { + if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_RATE)) { + speechRate = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_LANGUAGE)){ language = speechItem.mParams.get(i+1); } else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_COUNTRY)){ @@ -645,12 +648,15 @@ public class TtsService extends Service implements OnCompletionListener { } } } - if (language.length() > 0){ - setLanguage("", language, country, variant); - } } // Only do the synthesis if it has not been killed by a subsequent utterance. if (mKillList.get(speechItem) == null){ + if (language.length() > 0){ + setLanguage("", language, country, variant); + } + if (speechRate.length() > 0){ + setSpeechRate("", Integer.parseInt(speechRate)); + } nativeSynth.synthesizeToFile(speechItem.mText, speechItem.mFilename); } } catch (InterruptedException e) { |