Class TtsClient
Definition
- Assembly:
- Tizen.Uix.Tts.dll
You can use Text-To-Speech (TTS) API's to read sound data transformed by the engine from input texts. Applications can add input-text to queue for reading continuously and control the player that can play, pause, and stop sound data synthesized from text.
public class TtsClient : IDisposable
- Inheritance
-
objectTtsClient
Constructors
View SourceTtsClient()
Constructor to create a TTS instance.
Declaration
public TtsClient()
Properties
View SourceCurrentMode
The TTS Mode can be set using this property.
Declaration
public Mode CurrentMode { get; set; }
Property Value
| Type | Description |
|---|---|
| Mode | The current TTS mode (default, screen-reader, notification). |
CurrentServiceState
Gets the current state of TTS service.
Declaration
public ServiceState CurrentServiceState { get; }
Property Value
| Type | Description |
|---|---|
| ServiceState | The current state of TTS service. |
CurrentState
Gets the current TTS state.
Declaration
public State CurrentState { get; }
Property Value
| Type | Description |
|---|---|
| State | The current state of TTS. |
DefaultVoice
Gets the default voice set by the user.
Declaration
public SupportedVoice DefaultVoice { get; }
Property Value
| Type | Description |
|---|---|
| SupportedVoice | The default voice in TTS. |
IsScreenReaderOn
Gets the current status of screen reader.
Declaration
public bool IsScreenReaderOn { get; }
Property Value
| Type | Description |
|---|---|
| bool | The current status of screen reader. |
MaxTextSize
Gets the maximum byte size for text.
Declaration
public uint MaxTextSize { get; }
Property Value
| Type | Description |
|---|---|
| uint | The Maximum byte size for text. |
PlayingMode
Sets the current playing mode.
Declaration
public PlayingMode PlayingMode { get; set; }
Property Value
| Type | Description |
|---|---|
| PlayingMode | The current playing mode. |
Methods
View SourceAddText(string, string, int, int)
Adds a text to the queue.
Declaration
public int AddText(string text, string language, int voiceType, int speed)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | An input text. |
| string | language | The language selected from the SupportedVoice.Language Property obtained from GetSupportedVoices()(e.g. 'NULL'(Automatic),'en_US'). |
| int | voiceType | The voice type selected from the SupportedVoice.VoiceType Property obtained from GetSupportedVoices(). |
| int | speed | A speaking speed (e.g.0 for Auto or the value from SpeedRange Property). |
Returns
| Type | Description |
|---|---|
| int | The utterance ID. |
Remarks
Locale MUST be set for text validation check.
Dispose()
Method to release resources.
Declaration
public void Dispose()
Dispose(bool)
Method to release resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing | The boolean value for destoying tts handle. |
~TtsClient()
Destructor to destroy TtsClient handle.
Declaration
protected ~TtsClient()
GetPrivateData(string)
Gets the private data from TTS engine.
Declaration
public string GetPrivateData(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key string. |
Returns
| Type | Description |
|---|---|
| string | The data corresponding to the provided key. |
GetSpeedRange()
Gets the speed range.
Declaration
public SpeedRange GetSpeedRange()
Returns
| Type | Description |
|---|---|
| SpeedRange | The SpeedRange value. |
GetSupportedVoices()
Retrieves all supported voices of the current engine.
Declaration
public IEnumerable<SupportedVoice> GetSupportedVoices()
Returns
| Type | Description |
|---|---|
| IEnumerable<><SupportedVoice> | The list of SupportedVoice. |
Pause()
Pauses the currently playing utterance.
Declaration
public void Pause()
Play()
Starts synthesizing voice from the text and plays the synthesized audio data.
Declaration
public void Play()
Prepare()
Connects to the TTS service asynchronously.
Declaration
public void Prepare()
Repeat()
Repeats the last added text.
Declaration
public RepeatedText Repeat()
Returns
| Type | Description |
|---|---|
| RepeatedText | The RepeatedText instance which stores the text to repeat and its utterance ID. |
SetCredential(string)
Sets the application credential.
Declaration
public void SetCredential(string credential)
Parameters
| Type | Name | Description |
|---|---|---|
| string | credential | . The credential string. |
SetPrivateData(string, string)
Sets the private data to tts engine.
Declaration
public void SetPrivateData(string key, string data)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key string. |
| string | data | The data string. |
Stop()
Stops playing the utterance and clears the queue.
Declaration
public void Stop()
Unprepare()
Disconnects from the TTS service.
Declaration
public void Unprepare()
Events
View SourceDefaultVoiceChanged
Event to be invoked when an error occurs.
Declaration
public event EventHandler<DefaultVoiceChangedEventArgs> DefaultVoiceChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<><DefaultVoiceChangedEventArgs> |
EngineChanged
Event to be invoked to detect engine change.
Declaration
public event EventHandler<EngineChangedEventArgs> EngineChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<><EngineChangedEventArgs> |
ErrorOccurred
Event to be invoked when an error occurs.
Declaration
public event EventHandler<ErrorOccurredEventArgs> ErrorOccurred
Event Type
| Type | Description |
|---|---|
| EventHandler<><ErrorOccurredEventArgs> |
ScreenReaderChanged
Event to be invoked to detect screen reader status change.
Declaration
public event EventHandler<ScreenReaderChangedEventArgs> ScreenReaderChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<><ScreenReaderChangedEventArgs> |
ServiceStateChanged
Event to be invoked when the state of TTS service changes.
Declaration
public event EventHandler<ServiceStateChangedEventArgs> ServiceStateChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<><ServiceStateChangedEventArgs> |
StateChanged
Event to be invoked when TTS state changes.
Declaration
public event EventHandler<StateChangedEventArgs> StateChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<><StateChangedEventArgs> |
SynthesizedPcm
Event to be invoked when the synthesized pcm data comes from the engine.
Declaration
public event EventHandler<SynthesizedPcmEventArgs> SynthesizedPcm
Event Type
| Type | Description |
|---|---|
| EventHandler<><SynthesizedPcmEventArgs> |
UtteranceCompleted
Event to be invoked when the utterance completes.
Declaration
public event EventHandler<UtteranceEventArgs> UtteranceCompleted
Event Type
| Type | Description |
|---|---|
| EventHandler<><UtteranceEventArgs> |
UtteranceStarted
Event to be invoked when the utterance starts.
Declaration
public event EventHandler<UtteranceEventArgs> UtteranceStarted
Event Type
| Type | Description |
|---|---|
| EventHandler<><UtteranceEventArgs> |