Merge change 6155 into donut
* changes: Unhide android.speech.tts.TextToSpeech
This commit is contained in:
338
api/current.xml
338
api/current.xml
@@ -109109,6 +109109,344 @@
|
|||||||
</field>
|
</field>
|
||||||
</class>
|
</class>
|
||||||
</package>
|
</package>
|
||||||
|
<package name="android.speech.tts"
|
||||||
|
>
|
||||||
|
<class name="TextToSpeech"
|
||||||
|
extends="java.lang.Object"
|
||||||
|
abstract="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<constructor name="TextToSpeech"
|
||||||
|
type="android.speech.tts.TextToSpeech"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="context" type="android.content.Context">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="listener" type="android.speech.tts.TextToSpeech.OnInitListener">
|
||||||
|
</parameter>
|
||||||
|
</constructor>
|
||||||
|
<method name="addSpeech"
|
||||||
|
return="int"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="text" type="java.lang.String">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="packagename" type="java.lang.String">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="resourceId" type="int">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
|
<method name="addSpeech"
|
||||||
|
return="int"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="text" type="java.lang.String">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="filename" type="java.lang.String">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
|
<method name="getLanguage"
|
||||||
|
return="java.util.Locale"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</method>
|
||||||
|
<method name="isLanguageAvailable"
|
||||||
|
return="int"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="loc" type="java.util.Locale">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
|
<method name="isSpeaking"
|
||||||
|
return="boolean"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</method>
|
||||||
|
<method name="playEarcon"
|
||||||
|
return="int"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="earcon" type="java.lang.String">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="queueMode" type="int">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="params" type="java.util.HashMap<java.lang.String, java.lang.String>">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
|
<method name="playSilence"
|
||||||
|
return="int"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="durationInMs" type="long">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="queueMode" type="int">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
|
<method name="setLanguage"
|
||||||
|
return="int"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="loc" type="java.util.Locale">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
|
<method name="setPitch"
|
||||||
|
return="int"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="pitch" type="float">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
|
<method name="setSpeechRate"
|
||||||
|
return="int"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="speechRate" type="float">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
|
<method name="shutdown"
|
||||||
|
return="void"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</method>
|
||||||
|
<method name="speak"
|
||||||
|
return="int"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="text" type="java.lang.String">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="queueMode" type="int">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="params" type="java.util.HashMap<java.lang.String, java.lang.String>">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
|
<method name="stop"
|
||||||
|
return="int"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</method>
|
||||||
|
<method name="synthesizeToFile"
|
||||||
|
return="int"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="text" type="java.lang.String">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="params" type="java.util.HashMap<java.lang.String, java.lang.String>">
|
||||||
|
</parameter>
|
||||||
|
<parameter name="filename" type="java.lang.String">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
|
<field name="TTS_ERROR"
|
||||||
|
type="int"
|
||||||
|
transient="false"
|
||||||
|
volatile="false"
|
||||||
|
value="-1"
|
||||||
|
static="true"
|
||||||
|
final="true"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</field>
|
||||||
|
<field name="TTS_LANG_AVAILABLE"
|
||||||
|
type="int"
|
||||||
|
transient="false"
|
||||||
|
volatile="false"
|
||||||
|
value="0"
|
||||||
|
static="true"
|
||||||
|
final="true"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</field>
|
||||||
|
<field name="TTS_LANG_COUNTRY_AVAILABLE"
|
||||||
|
type="int"
|
||||||
|
transient="false"
|
||||||
|
volatile="false"
|
||||||
|
value="1"
|
||||||
|
static="true"
|
||||||
|
final="true"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</field>
|
||||||
|
<field name="TTS_LANG_COUNTRY_VAR_AVAILABLE"
|
||||||
|
type="int"
|
||||||
|
transient="false"
|
||||||
|
volatile="false"
|
||||||
|
value="2"
|
||||||
|
static="true"
|
||||||
|
final="true"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</field>
|
||||||
|
<field name="TTS_LANG_MISSING_DATA"
|
||||||
|
type="int"
|
||||||
|
transient="false"
|
||||||
|
volatile="false"
|
||||||
|
value="-1"
|
||||||
|
static="true"
|
||||||
|
final="true"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</field>
|
||||||
|
<field name="TTS_LANG_NOT_SUPPORTED"
|
||||||
|
type="int"
|
||||||
|
transient="false"
|
||||||
|
volatile="false"
|
||||||
|
value="-2"
|
||||||
|
static="true"
|
||||||
|
final="true"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</field>
|
||||||
|
<field name="TTS_QUEUE_ADD"
|
||||||
|
type="int"
|
||||||
|
transient="false"
|
||||||
|
volatile="false"
|
||||||
|
value="1"
|
||||||
|
static="true"
|
||||||
|
final="true"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</field>
|
||||||
|
<field name="TTS_QUEUE_FLUSH"
|
||||||
|
type="int"
|
||||||
|
transient="false"
|
||||||
|
volatile="false"
|
||||||
|
value="0"
|
||||||
|
static="true"
|
||||||
|
final="true"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</field>
|
||||||
|
<field name="TTS_SUCCESS"
|
||||||
|
type="int"
|
||||||
|
transient="false"
|
||||||
|
volatile="false"
|
||||||
|
value="0"
|
||||||
|
static="true"
|
||||||
|
final="true"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</field>
|
||||||
|
</class>
|
||||||
|
<interface name="TextToSpeech.OnInitListener"
|
||||||
|
abstract="true"
|
||||||
|
static="true"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<method name="onInit"
|
||||||
|
return="void"
|
||||||
|
abstract="true"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="false"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
<parameter name="status" type="int">
|
||||||
|
</parameter>
|
||||||
|
</method>
|
||||||
|
</interface>
|
||||||
|
</package>
|
||||||
<package name="android.telephony"
|
<package name="android.telephony"
|
||||||
>
|
>
|
||||||
<class name="CellLocation"
|
<class name="CellLocation"
|
||||||
|
|||||||
@@ -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 {
|
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.
|
* 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