diff options
| author | Jean-Michel Trivi <jmtrivi@google.com> | 2009-06-18 14:41:41 -0700 |
|---|---|---|
| committer | Jean-Michel Trivi <jmtrivi@google.com> | 2009-06-18 14:46:25 -0700 |
| commit | d146874d7341bc9602c93719582b4209e7b81f01 (patch) | |
| tree | c7f898fd22c65d837d96170532c85d96f99db84b | |
| parent | e748161ca89867e8c57d4e71c780486d4de8039c (diff) | |
| download | frameworks_base-d146874d7341bc9602c93719582b4209e7b81f01.zip frameworks_base-d146874d7341bc9602c93719582b4209e7b81f01.tar.gz frameworks_base-d146874d7341bc9602c93719582b4209e7b81f01.tar.bz2 | |
Grouping under TextToSpeech.Engine the constants to be used by
a TTS engine implementation or a settings application for default
values, and data integrity check return codes.
| -rwxr-xr-x | core/java/android/speech/tts/TextToSpeech.java | 22 | ||||
| -rwxr-xr-x | packages/TtsService/src/android/tts/TtsService.java | 16 |
2 files changed, 29 insertions, 9 deletions
diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java index 8f58194..9fc143d 100755 --- a/core/java/android/speech/tts/TextToSpeech.java +++ b/core/java/android/speech/tts/TextToSpeech.java @@ -81,6 +81,28 @@ public class TextToSpeech { } /** + * Internal constants for the TTS functionality + * + * {@hide} + */ + public class Engine { + // default values for a TTS engine when settings are not found in the provider + public static final int FALLBACK_TTS_DEFAULT_RATE = 100; // 1x + public static final int FALLBACK_TTS_DEFAULT_PITCH = 100;// 1x + public static final int FALLBACK_TTS_USE_DEFAULTS = 0; // false + public static final String FALLBACK_TTS_DEFAULT_LANG = "eng"; + public static final String FALLBACK_TTS_DEFAULT_COUNTRY = ""; + public static final String FALLBACK_TTS_DEFAULT_VARIANT = ""; + + // return codes for a TTS engine's check data activity + public static final int CHECK_VOICE_DATA_PASS = 1; + public static final int CHECK_VOICE_DATA_FAIL = 0; + public static final int CHECK_VOICE_DATA_BAD_DATA = -1; + public static final int CHECK_VOICE_DATA_MISSING_DATA = -2; + public static final int CHECK_VOICE_DATA_MISSING_DATA_NO_SDCARD = -3; + } + + /** * Connection needed for the TTS. */ private ServiceConnection mServiceConnection; diff --git a/packages/TtsService/src/android/tts/TtsService.java b/packages/TtsService/src/android/tts/TtsService.java index b50add6..e9c4ab7 100755 --- a/packages/TtsService/src/android/tts/TtsService.java +++ b/packages/TtsService/src/android/tts/TtsService.java @@ -15,9 +15,6 @@ */ package android.tts; -import android.speech.tts.ITts.Stub; -import android.speech.tts.ITtsCallback; - import android.app.Service; import android.content.ContentResolver; import android.content.Context; @@ -32,6 +29,9 @@ import android.os.IBinder; import android.os.RemoteCallbackList; import android.os.RemoteException; import android.preference.PreferenceManager; +import android.speech.tts.ITts.Stub; +import android.speech.tts.ITtsCallback; +import android.speech.tts.TextToSpeech; import android.util.Log; import java.util.ArrayList; import java.util.Arrays; @@ -93,10 +93,6 @@ public class TtsService extends Service implements OnCompletionListener { private static final String CATEGORY = "android.intent.category.TTS"; private static final String PKGNAME = "android.tts"; - private static final int FALLBACK_TTS_DEFAULT_RATE = 100; // 1x - private static final int FALLBACK_TTS_DEFAULT_PITCH = 100;// 1x - private static final int FALLBACK_TTS_USE_DEFAULTS = 0; - final RemoteCallbackList<android.speech.tts.ITtsCallback> mCallbacks = new RemoteCallbackList<ITtsCallback>(); private Boolean mIsSpeaking; @@ -162,14 +158,16 @@ public class TtsService extends Service implements OnCompletionListener { private boolean isDefaultEnforced() { return (android.provider.Settings.Secure.getInt(mResolver, - android.provider.Settings.Secure.TTS_USE_DEFAULTS, FALLBACK_TTS_USE_DEFAULTS) + android.provider.Settings.Secure.TTS_USE_DEFAULTS, + TextToSpeech.Engine.FALLBACK_TTS_USE_DEFAULTS) == 1 ); } private int getDefaultRate() { return android.provider.Settings.Secure.getInt(mResolver, - android.provider.Settings.Secure.TTS_DEFAULT_RATE, FALLBACK_TTS_DEFAULT_RATE); + android.provider.Settings.Secure.TTS_DEFAULT_RATE, + TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_RATE); } |
