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
- Implements
-
System.IDisposable
Constructors
View SourceTtsClient()
Constructor to create a TTS instance.
Declaration
public TtsClient()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.OutOfMemoryException | This exception can be due to out Of memory. |
System.NotSupportedException | This exception can be due to TTS not supported. |
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). |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons while setting the value:
|
System.OutOfMemoryException | This exception can be due to out Of memory. |
System.NotSupportedException | This exception can be due to TTS not supported. |
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. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | This exception can be due to TTS not supported. |
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. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to an invalid state. |
System.NotSupportedException | This exception can be due to TTS not supported. |
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.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to TTS not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
System.ArgumentException | This exception can be due to improper value provided while setting the value. |
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. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to TTS not supported. |
GetSpeedRange()
Gets the speed range.
Declaration
public SpeedRange GetSpeedRange()
Returns
Type | Description |
---|---|
SpeedRange | The SpeedRange value. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to TTS not supported. |
GetSupportedVoices()
Retrieves all supported voices of the current engine.
Declaration
public IEnumerable<SupportedVoice> GetSupportedVoices()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><SupportedVoice> | The list of SupportedVoice. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to TTS not supported. |
Pause()
Pauses the currently playing utterance.
Declaration
public void Pause()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to TTS not supported. |
Play()
Starts synthesizing voice from the text and plays the synthesized audio data.
Declaration
public void Play()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to TTS not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
Prepare()
Connects to the TTS service asynchronously.
Declaration
public void Prepare()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons while setting the value:
|
System.NotSupportedException | This exception can be due to TTS not supported. |
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. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to TTS not supported. |
SetCredential(string)
Sets the application credential.
Declaration
public void SetCredential(string credential)
Parameters
Type | Name | Description |
---|---|---|
string | credential | . The credential string. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to an invalid state. |
System.NotSupportedException | This exception can be due to TTS not supported. |
System.ArgumentException | This exception can be due to improper value provided while setting the value. |
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. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to TTS not supported. |
System.ArgumentException | This exception can be due to improper value provided while setting the value. |
Stop()
Stops playing the utterance and clears the queue.
Declaration
public void Stop()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to TTS not supported. |
Unprepare()
Disconnects from the TTS service.
Declaration
public void Unprepare()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to an invalid state. |
System.NotSupportedException | This exception can be due to TTS not supported. |
Events
View SourceDefaultVoiceChanged
Event to be invoked when an error occurs.
Declaration
public event EventHandler<DefaultVoiceChangedEventArgs> DefaultVoiceChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><DefaultVoiceChangedEventArgs> |
EngineChanged
Event to be invoked to detect engine change.
Declaration
public event EventHandler<EngineChangedEventArgs> EngineChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><EngineChangedEventArgs> |
ErrorOccurred
Event to be invoked when an error occurs.
Declaration
public event EventHandler<ErrorOccurredEventArgs> ErrorOccurred
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><ErrorOccurredEventArgs> |
ScreenReaderChanged
Event to be invoked to detect screen reader status change.
Declaration
public event EventHandler<ScreenReaderChangedEventArgs> ScreenReaderChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><ScreenReaderChangedEventArgs> |
ServiceStateChanged
Event to be invoked when the state of TTS service changes.
Declaration
public event EventHandler<ServiceStateChangedEventArgs> ServiceStateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><ServiceStateChangedEventArgs> |
StateChanged
Event to be invoked when TTS state changes.
Declaration
public event EventHandler<StateChangedEventArgs> StateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><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 |
---|---|
System.EventHandler<TEventArgs><SynthesizedPcmEventArgs> |
UtteranceCompleted
Event to be invoked when the utterance completes.
Declaration
public event EventHandler<UtteranceEventArgs> UtteranceCompleted
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><UtteranceEventArgs> |
UtteranceStarted
Event to be invoked when the utterance starts.
Declaration
public event EventHandler<UtteranceEventArgs> UtteranceStarted
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><UtteranceEventArgs> |