diff options
-rwxr-xr-x | core/java/android/speech/tts/ITts.aidl | 6 | ||||
-rwxr-xr-x | packages/TtsService/src/android/tts/TtsService.java | 120 |
2 files changed, 4 insertions, 122 deletions
diff --git a/core/java/android/speech/tts/ITts.aidl b/core/java/android/speech/tts/ITts.aidl index 15f3876..5612ecd 100755 --- a/core/java/android/speech/tts/ITts.aidl +++ b/core/java/android/speech/tts/ITts.aidl @@ -33,8 +33,6 @@ interface ITts { void speak(in String text, in int queueMode, in String[] params);
- void speakIpa(in String ipaText, in int queueMode, in String[] params);
-
boolean isSpeaking();
void stop();
@@ -49,9 +47,7 @@ interface ITts { void setLanguage(in String language, in String country, in String variant);
- boolean synthesizeToFile(in String text, in String[] params, in String outputDirectory); -
- boolean synthesizeIpaToFile(in String ipaText, in String[] params, in String outputDirectory);
+ boolean synthesizeToFile(in String text, in String[] params, in String outputDirectory);
void playEarcon(in String earcon, in int queueMode, in String[] params);
diff --git a/packages/TtsService/src/android/tts/TtsService.java b/packages/TtsService/src/android/tts/TtsService.java index b5f5b37..5c0c55c 100755 --- a/packages/TtsService/src/android/tts/TtsService.java +++ b/packages/TtsService/src/android/tts/TtsService.java @@ -48,11 +48,9 @@ public class TtsService extends Service implements OnCompletionListener { private static class SpeechItem { public static final int TEXT = 0; - public static final int IPA = 1; - public static final int EARCON = 2; - public static final int SILENCE = 3; - public static final int TEXT_TO_FILE = 5; - public static final int IPA_TO_FILE = 6; + public static final int EARCON = 1; + public static final int SILENCE = 2; + public static final int TEXT_TO_FILE = 3; public String mText = null; public ArrayList<String> mParams = null; public int mType = TEXT; @@ -327,28 +325,6 @@ public class TtsService extends Service implements OnCompletionListener { } /** - * Speaks the given IPA text using the specified queueing mode and parameters. - * - * @param ipaText - * The IPA text that should be spoken - * @param queueMode - * 0 for no queue (interrupts all previous utterances), 1 for - * queued - * @param params - * An ArrayList of parameters. This is not implemented for all - * engines. - */ - private void speakIpa(String ipaText, int queueMode, ArrayList<String> params) { - if (queueMode == 0) { - stop(); - } - mSpeechQueue.add(new SpeechItem(ipaText, params, SpeechItem.IPA)); - if (!mIsSpeaking) { - processSpeechQueue(); - } - } - - /** * Plays the earcon using the specified queueing mode and parameters. * * @param earcon @@ -617,8 +593,6 @@ public class TtsService extends Service implements OnCompletionListener { } else if (currentSpeechItem.mType == SpeechItem.TEXT_TO_FILE) { synthToFileInternalOnly(currentSpeechItem.mText, currentSpeechItem.mParams, currentSpeechItem.mFilename); - } else if (currentSpeechItem.mType == SpeechItem.IPA) { - // TODO Implement IPA support } else { // This is either silence or an earcon that was missing silence(currentSpeechItem.mDuration); @@ -714,51 +688,6 @@ public class TtsService extends Service implements OnCompletionListener { return true; } - /** - * Synthesizes the given IPA text to a file using the specified parameters. - * - * @param ipaText - * The String of IPA text that should be synthesized - * @param params - * An ArrayList of parameters. The first element of this array - * controls the type of voice to use. - * @param filename - * The string that gives the full output filename; it should be - * something like "/sdcard/myappsounds/mysound.wav". - * @return A boolean that indicates if the synthesis succeeded - */ - private boolean synthesizeIpaToFile(String ipaText, ArrayList<String> params, - String filename, boolean calledFromApi) { - // Only stop everything if this is a call made by an outside app trying - // to - // use the API. Do NOT stop if this is a call from within the service as - // clearing the speech queue here would be a mistake. - if (calledFromApi) { - stop(); - } - Log.i("TTS", "Synthesizing IPA to " + filename); - boolean synthAvailable = false; - try { - synthAvailable = synthesizerLock.tryLock(); - if (!synthAvailable) { - return false; - } - // Don't allow a filename that is too long - if (filename.length() > MAX_FILENAME_LENGTH) { - return false; - } - // TODO: Add nativeSynth.synthesizeIpaToFile(text, filename); - } finally { - // This check is needed because finally will always run; even if the - // method returns somewhere in the try block. - if (synthAvailable) { - synthesizerLock.unlock(); - } - } - Log.i("TTS", "Completed synthesis for " + filename); - return true; - } - @Override public IBinder onBind(Intent intent) { if (ACTION.equals(intent.getAction())) { @@ -805,27 +734,6 @@ public class TtsService extends Service implements OnCompletionListener { } /** - * Speaks the given IPA text using the specified queueing mode and - * parameters. - * - * @param ipaText - * The IPA text that should be spoken - * @param queueMode - * 0 for no queue (interrupts all previous utterances), 1 for - * queued - * @param params - * An ArrayList of parameters. The first element of this - * array controls the type of voice to use. - */ - public void speakIpa(String ipaText, int queueMode, String[] params) { - ArrayList<String> speakingParams = new ArrayList<String>(); - if (params != null) { - speakingParams = new ArrayList<String>(Arrays.asList(params)); - } - mSelf.speakIpa(ipaText, queueMode, speakingParams); - } - - /** * Plays the earcon using the specified queueing mode and parameters. * * @param earcon @@ -1014,28 +922,6 @@ public class TtsService extends Service implements OnCompletionListener { return mSelf.synthesizeToFile(text, speakingParams, filename); } - /** - * Synthesizes the given IPA text to a file using the specified - * parameters. - * - * @param ipaText - * The String of IPA text that should be synthesized - * @param params - * An ArrayList of parameters. The first element of this - * array controls the type of voice to use. - * @param filename - * The string that gives the full output filename; it should - * be something like "/sdcard/myappsounds/mysound.wav". - * @return A boolean that indicates if the synthesis succeeded - */ - public boolean synthesizeIpaToFile(String ipaText, String[] params, - String filename) { - ArrayList<String> speakingParams = new ArrayList<String>(); - if (params != null) { - speakingParams = new ArrayList<String>(Arrays.asList(params)); - } - return mSelf.synthesizeIpaToFile(ipaText, speakingParams, filename, true); - } }; } |