summaryrefslogtreecommitdiffstats
path: root/core/java/android/speech/tts
diff options
context:
space:
mode:
authorPrzemyslaw Szczepaniak <pszczepaniak@google.com>2012-11-15 11:41:36 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-11-16 03:14:22 -0800
commitf288a64f5bed290d162c1a6fd54bea7c0ba14042 (patch)
tree27b3da91e9240b2f857ba5698cac16a9f5ad41ca /core/java/android/speech/tts
parent923584df774535ad839a2e0d238069c5ad48c070 (diff)
downloadframeworks_base-f288a64f5bed290d162c1a6fd54bea7c0ba14042.zip
frameworks_base-f288a64f5bed290d162c1a6fd54bea7c0ba14042.tar.gz
frameworks_base-f288a64f5bed290d162c1a6fd54bea7c0ba14042.tar.bz2
Make TTS input string limit public and documented
Bug: 7456118 Change-Id: Iced44eb349e1abb551f991c2b9357a03bab3bb3d
Diffstat (limited to 'core/java/android/speech/tts')
-rw-r--r--core/java/android/speech/tts/TextToSpeech.java12
-rw-r--r--core/java/android/speech/tts/TextToSpeechService.java4
2 files changed, 12 insertions, 4 deletions
diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java
index 9d570fc..0f787e7 100644
--- a/core/java/android/speech/tts/TextToSpeech.java
+++ b/core/java/android/speech/tts/TextToSpeech.java
@@ -203,6 +203,12 @@ public class TextToSpeech {
public static final int USE_DEFAULTS = 0; // false
/**
+ * Limit of length of input string passed to speak/synthesizeToFile.
+ * Larger strings will be rejected.
+ */
+ public static final int MAX_SPEECH_STRING_LENGTH = 4000;
+
+ /**
* Package name of the default TTS engine.
*
* @hide
@@ -801,7 +807,8 @@ public class TextToSpeech {
* {@link #setOnUtteranceProgressListener}) and using the
* {@link Engine#KEY_PARAM_UTTERANCE_ID} parameter.
*
- * @param text The string of text to be spoken.
+ * @param text The string of text to be spoken. No longer than
+ * {@link Engine#MAX_SPEECH_STRING_LENGTH} characters.
* @param queueMode The queuing strategy to use, {@link #QUEUE_ADD} or {@link #QUEUE_FLUSH}.
* @param params Parameters for the request. Can be null.
* Supported parameter names:
@@ -1113,7 +1120,8 @@ public class TextToSpeech {
* {@link #setOnUtteranceProgressListener}) and using the
* {@link Engine#KEY_PARAM_UTTERANCE_ID} parameter.
*
- * @param text The text that should be synthesized
+ * @param text The text that should be synthesized. No longer than
+ * {@link Engine#MAX_SPEECH_STRING_LENGTH} characters.
* @param params Parameters for the request. Can be null.
* Supported parameter names:
* {@link Engine#KEY_PARAM_UTTERANCE_ID}.
diff --git a/core/java/android/speech/tts/TextToSpeechService.java b/core/java/android/speech/tts/TextToSpeechService.java
index d124e68..b8eef0c 100644
--- a/core/java/android/speech/tts/TextToSpeechService.java
+++ b/core/java/android/speech/tts/TextToSpeechService.java
@@ -74,7 +74,7 @@ public abstract class TextToSpeechService extends Service {
private static final boolean DBG = false;
private static final String TAG = "TextToSpeechService";
- private static final int MAX_SPEECH_ITEM_CHAR_LENGTH = 4000;
+
private static final String SYNTH_THREAD_NAME = "SynthThread";
private SynthHandler mSynthHandler;
@@ -552,7 +552,7 @@ public abstract class TextToSpeechService extends Service {
Log.e(TAG, "null synthesis text");
return false;
}
- if (mText.length() >= MAX_SPEECH_ITEM_CHAR_LENGTH) {
+ if (mText.length() >= TextToSpeech.Engine.MAX_SPEECH_STRING_LENGTH) {
Log.w(TAG, "Text too long: " + mText.length() + " chars");
return false;
}