Class TtsClient
Definition
- Namespace:
- Tizen.Uix.Tts
- Assembly:
- Tizen.Uix.Tts.dll
- API Level:
- 3
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
-
TtsClient
- Implements
Constructors
View SourceTtsClient()
Constructor to create a TTS instance.
Declaration
public TtsClient()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This exception can be due to the following reasons:
|
OutOfMemoryException | This exception can be due to out Of memory. |
NotSupportedException | This exception can be due to TTS not supported. |
API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
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 |
---|---|
InvalidOperationException | This exception can be due to the following reasons while setting the value:
|
OutOfMemoryException | This exception can be due to out Of memory. |
NotSupportedException | This exception can be due to TTS not supported. |
API Level: 3
Precondition: The State should be created.
View SourceCurrentState
Gets the current TTS state.
Declaration
public State CurrentState { get; }
Property Value
Type | Description |
---|---|
State | The current state of TTS. |
API Level: 3
View SourceDefaultVoice
Gets the default voice set by the user.
Declaration
public SupportedVoice DefaultVoice { get; }
Property Value
Type | Description |
---|---|
SupportedVoice | The default voice in TTS. |
API Level: 3
View SourceMaxTextSize
Gets the maximum byte size for text.
Declaration
public uint MaxTextSize { get; }
Property Value
Type | Description |
---|---|
UInt32 | The Maximum byte size for text. |
API Level: 3
Precondition: The State should be ready.
Methods
View SourceAddText(String, String, Int32, Int32)
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 based UTF-8. |
String | language | The language selected from the SupportedVoice.Language Property obtained from GetSupportedVoices()(e.g. 'NULL'(Automatic),'en_US'). |
Int32 | voiceType | The voice type selected from the SupportedVoice.VoiceType Property obtained from GetSupportedVoices(). |
Int32 | speed | A speaking speed (e.g.0 for Auto or the value from SpeedRange Property). |
Returns
Type | Description |
---|---|
Int32 | The utterance ID. |
Remarks
Locale MUST be set for UTF-8 text validation check.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This exception can be due to the following reasons:
|
NotSupportedException | This exception can be due to TTS not supported. |
UnauthorizedAccessException | This exception can be due to permission denied. |
ArgumentException | This exception can be due to improper value provided while setting the value. |
API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The state must be ready or playing or paused.
View SourceDispose()
Method to release resources.
Declaration
public void Dispose()
API Level: 3
View SourceDispose(Boolean)
Method to release resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing | The boolean value for destoying tts handle. |
API Level: 3
View SourceFinalize()
Destructor to destroy TtsClient handle.
Declaration
protected void Finalize()
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 |
---|---|
InvalidOperationException | This exception can be due to the following reasons:
|
NotSupportedException | This exception can be due to TTS not supported. |
API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The state must be ready.
View SourceGetSpeedRange()
Gets the speed range.
Declaration
public SpeedRange GetSpeedRange()
Returns
Type | Description |
---|---|
SpeedRange | The SpeedRange value. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This exception can be due to the following reasons:
|
NotSupportedException | This exception can be due to TTS not supported. |
API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The state must be created.
View SourceGetSupportedVoices()
Retrieves all supported voices of the current engine.
Declaration
public IEnumerable<SupportedVoice> GetSupportedVoices()
Returns
Type | Description |
---|---|
IEnumerable<SupportedVoice> | The list of SupportedVoice. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This exception can be due to the following reasons:
|
NotSupportedException | This exception can be due to TTS not supported. |
API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
View SourcePause()
Pauses the currently playing utterance.
Declaration
public void Pause()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This exception can be due to the following reasons:
|
NotSupportedException | This exception can be due to TTS not supported. |
API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The state must be playing.
Postcondition: If this function succeeds, the TTS state will be Paused.
View SourcePlay()
Starts synthesizing voice from the text and plays the synthesized audio data.
Declaration
public void Play()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This exception can be due to the following reasons:
|
NotSupportedException | This exception can be due to TTS not supported. |
UnauthorizedAccessException | This exception can be due to permission denied. |
API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The state must be ready or paused.
Postcondition: If this function succeeds, the TTS state will be playing.
View SourcePrepare()
Connects to the TTS service asynchronously.
Declaration
public void Prepare()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This exception can be due to an invalid state. |
NotSupportedException | This exception can be due to TTS not supported. |
API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The State must be Created.
Postcondition: If this function is successful, the TTS state will be ready. If this function is unsuccessful, ErrorOccurred event will be invoked.
View SourceSetCredential(String)
Sets the application credential.
Declaration
public void SetCredential(string credential)
Parameters
Type | Name | Description |
---|---|---|
String | credential | . The credential string. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This exception can be due to an invalid state. |
NotSupportedException | This exception can be due to TTS not supported. |
ArgumentException | This exception can be due to improper value provided while setting the value. |
API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The State should be created or ready.
View SourceSetPrivateData(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 |
---|---|
InvalidOperationException | This exception can be due to the following reasons:
|
NotSupportedException | This exception can be due to TTS not supported. |
ArgumentException | This exception can be due to improper value provided while setting the value. |
API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The state must be ready.
View SourceStop()
Stops playing the utterance and clears the queue.
Declaration
public void Stop()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This exception can be due to the following reasons:
|
NotSupportedException | This exception can be due to TTS not supported. |
API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The state must be ready or playing or paused.
Postcondition: If this function succeeds, the TTS state will be ready. This function will remove all text added via AddText() and synthesized sound data.
View SourceUnprepare()
Disconnects from the STT service.
Declaration
public void Unprepare()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This exception can be due to an invalid state. |
NotSupportedException | This exception can be due to TTS not supported. |
API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The state must be ready.
Postcondition: If this function is successful, the TTS state will be created.
Events
View SourceDefaultVoiceChanged
Event to be invoked when an error occurs.
Declaration
public event EventHandler<DefaultVoiceChangedEventArgs> DefaultVoiceChanged
Event Type
Type | Description |
---|---|
EventHandler<DefaultVoiceChangedEventArgs> |
API Level: 3
View SourceEngineChanged
Event to be invoked to detect engine change.
Declaration
public event EventHandler<EngineChangedEventArgs> EngineChanged
Event Type
Type | Description |
---|---|
EventHandler<EngineChangedEventArgs> |
API Level: 3
View SourceErrorOccurred
Event to be invoked when an error occurs.
Declaration
public event EventHandler<ErrorOccurredEventArgs> ErrorOccurred
Event Type
Type | Description |
---|---|
EventHandler<ErrorOccurredEventArgs> |
API Level: 4
View SourceStateChanged
Event to be invoked when TTS state changes.
Declaration
public event EventHandler<StateChangedEventArgs> StateChanged
Event Type
Type | Description |
---|---|
EventHandler<StateChangedEventArgs> |
API Level: 3
View SourceUtteranceCompleted
Event to be invoked when the utterance completes.
Declaration
public event EventHandler<UtteranceEventArgs> UtteranceCompleted
Event Type
Type | Description |
---|---|
EventHandler<UtteranceEventArgs> |
API Level: 3
View SourceUtteranceStarted
Event to be invoked when the utterance starts.
Declaration
public event EventHandler<UtteranceEventArgs> UtteranceStarted
Event Type
Type | Description |
---|---|
EventHandler<UtteranceEventArgs> |