am b29f8283: Merge change 6155 into donut
Merge commit 'b29f8283d06c2ab4eb54c991d7ffb5181d91af15' * commit 'b29f8283d06c2ab4eb54c991d7ffb5181d91af15': Unhide android.speech.tts.TextToSpeech
This commit is contained in:
committed by
The Android Open Source Project
commit
ce7dd2a56c
@@ -31,11 +31,10 @@ import java.util.Locale;
|
||||
|
||||
/**
|
||||
*
|
||||
* Synthesizes speech from text.
|
||||
* Synthesizes speech from text for immediate playback or to create a sound file.
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
//TODO #TTS# review + complete javadoc + add links to constants
|
||||
//TODO complete javadoc + add links to constants
|
||||
public class TextToSpeech {
|
||||
|
||||
/**
|
||||
@@ -369,54 +368,6 @@ public class TextToSpeech {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Speaks the IPA string using the specified queuing strategy and speech
|
||||
* parameters. Note that the speech parameters are not universally supported
|
||||
* by all engines and will be treated as a hint. The TTS library will try to
|
||||
* fulfill these parameters as much as possible, but there is no guarantee
|
||||
* that the voice used will have the properties specified.
|
||||
*
|
||||
* @param ipaText
|
||||
* The string of IPA text to be spoken.
|
||||
* @param queueMode
|
||||
* The queuing strategy to use.
|
||||
* See TTS_QUEUE_ADD and TTS_QUEUE_FLUSH.
|
||||
* @param params
|
||||
* The hashmap of speech parameters to be used.
|
||||
*
|
||||
* @return Code indicating success or failure. See TTS_ERROR and TTS_SUCCESS.
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
public int speakIpa(String ipaText, int queueMode, HashMap<String,String> params)
|
||||
{
|
||||
synchronized (mStartLock) {
|
||||
Log.i("TTS received: ", ipaText);
|
||||
if (!mStarted) {
|
||||
return TTS_ERROR;
|
||||
}
|
||||
try {
|
||||
// TODO support extra parameters, passing cache of current parameters for the moment
|
||||
mITts.speakIpa(ipaText, queueMode, mCachedParams);
|
||||
return TTS_SUCCESS;
|
||||
} catch (RemoteException e) {
|
||||
// TTS died; restart it.
|
||||
mStarted = false;
|
||||
initTts();
|
||||
} catch (NullPointerException e) {
|
||||
// TTS died; restart it.
|
||||
mStarted = false;
|
||||
initTts();
|
||||
} catch (IllegalStateException e) {
|
||||
// TTS died; restart it.
|
||||
mStarted = false;
|
||||
initTts();
|
||||
}
|
||||
return TTS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Plays the earcon using the specified queueing mode and parameters.
|
||||
*
|
||||
@@ -755,48 +706,4 @@ public class TextToSpeech {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Synthesizes the given IPA text to a file using the specified parameters.
|
||||
*
|
||||
* @param text
|
||||
* The String of text that should be synthesized
|
||||
* @param params
|
||||
* A hashmap of parameters.
|
||||
* @param filename
|
||||
* The string that gives the full output filename; it should be
|
||||
* something like "/sdcard/myappsounds/mysound.wav".
|
||||
*
|
||||
* @return Code indicating success or failure. See TTS_ERROR and TTS_SUCCESS.
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
public int synthesizeIpaToFile(String ipaText,
|
||||
HashMap<String,String> params, String filename) {
|
||||
synchronized (mStartLock) {
|
||||
if (!mStarted) {
|
||||
return TTS_ERROR;
|
||||
}
|
||||
try {
|
||||
// TODO support extra parameters, passing null for the moment
|
||||
if (mITts.synthesizeIpaToFile(ipaText, null, filename)){
|
||||
return TTS_SUCCESS;
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
// TTS died; restart it.
|
||||
mStarted = false;
|
||||
initTts();
|
||||
} catch (NullPointerException e) {
|
||||
// TTS died; restart it.
|
||||
mStarted = false;
|
||||
initTts();
|
||||
} catch (IllegalStateException e) {
|
||||
// TTS died; restart it.
|
||||
mStarted = false;
|
||||
initTts();
|
||||
}
|
||||
return TTS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user