java.lang.Object | ||||
↳ | android.content.Context | |||
↳ | android.content.ContextWrapper | |||
↳ | android.app.Service | |||
↳ | android.speech.tts.TextToSpeechService |
Abstract base class for TTS engine implementations. The following methods need to be implemented.
onIsLanguageAvailable(String, String, String)
onLoadLanguage(String, String, String)
onGetLanguage()
onSynthesizeText(SynthesisRequest, SynthesisCallback)
onStop()
onSynthesizeText(SynthesisRequest, SynthesisCallback)
is central to the engine implementation. The
implementation should synthesize text as per the request parameters and
return synthesized data via the supplied callback. This class and its helpers
will then consume that data, which might mean queueing it for playback or writing
it to a file or similar. All calls to this method will be on a single
thread, which will be different from the main thread of the service. Synthesis
must be synchronous which means the engine must NOT hold on the callback or call
any methods on it after the method returns
onStop()
tells the engine that it should stop all ongoing synthesis, if
any. Any pending data from the current synthesis will be discarded.
[Expand]
Inherited Constants
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Service
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From class
android.content.Context
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
android.content.ComponentCallbacks2
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Return the communication channel to the service.
|
||||||||||
|
Called by the system when the service is first created.
|
||||||||||
|
Called by the system to notify a Service that it is no longer used and is being removed.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Queries the service for a set of features supported for a given language.
|
||||||||||
|
Returns the language, country and variant currently being used by the TTS engine.
|
||||||||||
|
Checks whether the engine supports a given language.
|
||||||||||
|
Notifies the engine that it should load a speech synthesis language.
|
||||||||||
|
Notifies the service that it should stop any in-progress speech synthesis.
|
||||||||||
|
Tells the service to synthesize speech from the given text.
|
[Expand]
Inherited Methods
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Service
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From class
android.content.ContextWrapper
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From class
android.content.Context
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From class
java.lang.Object
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
android.content.ComponentCallbacks
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
android.content.ComponentCallbacks2
|
Return the communication channel to the service. May return null if
clients can not bind to the service. The returned
IBinder
is usually for a complex interface
that has been
described using
aidl
.
Note that unlike other application components, calls on to the IBinder interface returned here may not happen on the main thread of the process . More information about the main thread can be found in Processes and Threads .
intent |
The Intent that was used to bind to this service,
as given to
Context.bindService
. Note that any extras that were included with
the Intent at that point will
not
be seen here.
|
---|
Called by the system when the service is first created. Do not call this method directly.
Called by the system to notify a Service that it is no longer used and is being removed. The service should clean up any resources it holds (threads, registered receivers, etc) at this point. Upon return, there will be no more calls in to this Service object and it is effectively dead. Do not call this method directly.
Queries the service for a set of features supported for a given language.
lang | ISO-3 language code. |
---|---|
country | ISO-3 country code. May be empty or null. |
variant | Language variant. May be empty or null. |
Returns the language, country and variant currently being used by the TTS engine. Can be called on multiple threads.
""
. If country is empty, then variant must
be empty too.
Checks whether the engine supports a given language. Can be called on multiple threads. Its return values HAVE to be consistent with onLoadLanguage.
lang | ISO-3 language code. |
---|---|
country | ISO-3 country code. May be empty or null. |
variant | Language variant. May be empty or null. |
LANG_AVAILABLE
,
LANG_COUNTRY_AVAILABLE
,
LANG_COUNTRY_VAR_AVAILABLE
,
LANG_MISSING_DATA
LANG_NOT_SUPPORTED
.
Notifies the engine that it should load a speech synthesis language. There is no guarantee that this method is always called before the language is used for synthesis. It is merely a hint to the engine that it will probably get some synthesis requests for this language at some point in the future. Can be called on multiple threads. In <= Android 4.2 (<= API 17) can be called on main and service binder threads. In > Android 4.2 (> API 17) can be called on main and synthesis threads.
lang | ISO-3 language code. |
---|---|
country | ISO-3 country code. May be empty or null. |
variant | Language variant. May be empty or null. |
LANG_AVAILABLE
,
LANG_COUNTRY_AVAILABLE
,
LANG_COUNTRY_VAR_AVAILABLE
,
LANG_MISSING_DATA
LANG_NOT_SUPPORTED
.
Notifies the service that it should stop any in-progress speech synthesis. This method can be called even if no speech synthesis is currently in progress. Can be called on multiple threads, but not on the synthesis thread.
Tells the service to synthesize speech from the given text. This method should block until the synthesis is finished. Called on the synthesis thread.
request | The synthesis request. |
---|---|
callback | The callback the the engine must use to make data available for playback or for writing to a file. |