diff options
author | Bjorn Bringert <bringert@android.com> | 2011-04-19 09:21:17 +0100 |
---|---|---|
committer | Bjorn Bringert <bringert@android.com> | 2011-04-19 09:21:17 +0100 |
commit | 9ec0645e7801f0b306ac8a24b0e118e24abdf67e (patch) | |
tree | 8394f74063c77a212c7ace5152e2e4fe3859e73a /pico/compat | |
parent | 3e3743f1009e14118b1387d5c57402aee14ba40c (diff) | |
download | external_svox-9ec0645e7801f0b306ac8a24b0e118e24abdf67e.zip external_svox-9ec0645e7801f0b306ac8a24b0e118e24abdf67e.tar.gz external_svox-9ec0645e7801f0b306ac8a24b0e118e24abdf67e.tar.bz2 |
Use new SynthesisRequest.error()
Change-Id: Ia634e6c84870ad6c2d1665da796adcd9cdc4ec8f
Diffstat (limited to 'pico/compat')
-rwxr-xr-x | pico/compat/src/com/android/tts/compat/CompatTtsService.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/pico/compat/src/com/android/tts/compat/CompatTtsService.java b/pico/compat/src/com/android/tts/compat/CompatTtsService.java index 1ec7ebf..db1d9d8 100755 --- a/pico/compat/src/com/android/tts/compat/CompatTtsService.java +++ b/pico/compat/src/com/android/tts/compat/CompatTtsService.java @@ -105,8 +105,11 @@ public abstract class CompatTtsService extends TextToSpeechService { } @Override - protected int onSynthesizeText(SynthesisRequest request) { - if (mNativeSynth == null) return TextToSpeech.ERROR; + protected void onSynthesizeText(SynthesisRequest request) { + if (mNativeSynth == null) { + request.error(); + return; + } // Set language String lang = request.getLanguage(); @@ -114,25 +117,31 @@ public abstract class CompatTtsService extends TextToSpeechService { String variant = request.getVariant(); if (mNativeSynth.setLanguage(lang, country, variant) != TextToSpeech.SUCCESS) { Log.e(TAG, "setLanguage(" + lang + "," + country + "," + variant + ") failed"); - return TextToSpeech.ERROR; + request.error(); + return; } // Set speech rate int speechRate = request.getSpeechRate(); if (mNativeSynth.setSpeechRate(speechRate) != TextToSpeech.SUCCESS) { Log.e(TAG, "setSpeechRate(" + speechRate + ") failed"); - return TextToSpeech.ERROR; + request.error(); + return; } // Set speech int pitch = request.getPitch(); if (mNativeSynth.setPitch(pitch) != TextToSpeech.SUCCESS) { Log.e(TAG, "setPitch(" + pitch + ") failed"); - return TextToSpeech.ERROR; + request.error(); + return; } // Synthesize - return mNativeSynth.speak(request); + if (mNativeSynth.speak(request) != TextToSpeech.SUCCESS) { + request.error(); + return; + } } @Override |