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.

C#
Copy
public class TtsClient : IDisposable
Inheritance
System.Object
TtsClient
Implements
System.IDisposable

Constructors

View Source

TtsClient()

Constructor to create a TTS instance.

Declaration
C#
Copy
public TtsClient()
Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Operation Failed
  2. Engine Not Found
OutOfMemoryException

This exception can be due to out Of memory.

System.NotSupportedException

This exception can be due to TTS not supported.

API Level: 3
Feature: http://tizen.org/feature/speech.synthesis

Properties

View Source

CurrentMode

The TTS Mode can be set using this property.

Declaration
C#
Copy
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:

  1. Operation Failed
  2. Engine Not Found
OutOfMemoryException

This exception can be due to out Of memory.

System.NotSupportedException

This exception can be due to TTS not supported.

API Level: 3
Precondition: The Client must be in the state.
View Source

CurrentServiceState

Gets the current state of TTS service.

Declaration
C#
Copy
public ServiceState CurrentServiceState { get; }
Property Value
Type Description
ServiceState

The current state of TTS service.

API Level: 10
View Source

CurrentState

Gets the current TTS state.

Declaration
C#
Copy
public State CurrentState { get; }
Property Value
Type Description
State

The current state of TTS.

API Level: 3
View Source

DefaultVoice

Gets the default voice set by the user.

Declaration
C#
Copy
public SupportedVoice DefaultVoice { get; }
Property Value
Type Description
SupportedVoice

The default voice in TTS.

API Level: 3
View Source

IsScreenReaderOn

Gets the current status of screen reader.

Declaration
C#
Copy
public bool IsScreenReaderOn { get; }
Property Value
Type Description
Boolean

The current status of screen reader.

Exceptions
Type Condition
System.NotSupportedException

This exception can be due to TTS not supported.

API Level: 9
Feature: http://tizen.org/feature/speech.synthesis
View Source

MaxTextSize

Gets the maximum byte size for text.

Declaration
C#
Copy
public uint MaxTextSize { get; }
Property Value
Type Description
System.UInt32

The Maximum byte size for text.

API Level: 3
Precondition: The Client must be in the state.

Methods

View Source

AddText(String, String, Int32, Int32)

Adds a text to the queue.

Declaration
C#
Copy
public int AddText(string text, string language, int voiceType, int speed)
Parameters
Type Name Description
System.String text

An input text.

System.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 text validation check.

Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Invalid State
  2. Operation Failure
  3. Invalid Voice
  4. Screen reader off
System.NotSupportedException

This exception can be due to TTS not supported.

UnauthorizedAccessException

This exception can be due to permission denied.

System.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 Client must be in the , , or state.
View Source

Dispose()

Method to release resources.

Declaration
C#
Copy
public void Dispose()
API Level: 3
View Source

Dispose(Boolean)

Method to release resources.

Declaration
C#
Copy
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
Boolean disposing

The boolean value for destoying tts handle.

API Level: 3
View Source

Finalize()

Destructor to destroy TtsClient handle.

Declaration
C#
Copy
protected void Finalize()
View Source

GetPrivateData(String)

Gets the private data from TTS engine.

Declaration
C#
Copy
public string GetPrivateData(string key)
Parameters
Type Name Description
System.String key

The key string.

Returns
Type Description
System.String

The data corresponding to the provided key.

Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Invalid State
  2. Engine Not found
  3. Operation Failure
System.NotSupportedException

This exception can be due to TTS not supported.

API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The Client must be in the state.
View Source

GetSpeedRange()

Gets the speed range.

Declaration
C#
Copy
public SpeedRange GetSpeedRange()
Returns
Type Description
SpeedRange

The SpeedRange value.

Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Invalid State
  2. Operation Failure
System.NotSupportedException

This exception can be due to TTS not supported.

API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The Client must be in the state.
View Source

GetSupportedVoices()

Retrieves all supported voices of the current engine.

Declaration
C#
Copy
public IEnumerable<SupportedVoice> GetSupportedVoices()
Returns
Type Description
System.Collections.Generic.IEnumerable<SupportedVoice>

The list of SupportedVoice.

Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Engine Not Found
  2. Operation Failed
System.NotSupportedException

This exception can be due to TTS not supported.

API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
View Source

Pause()

Pauses the currently playing utterance.

Declaration
C#
Copy
public void Pause()
Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Invalid State
  2. Operation Failure
  3. Screen reader off
System.NotSupportedException

This exception can be due to TTS not supported.

API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The Client must be in the state.
Postcondition: If this function succeeds, the Client will be in the state.
View Source

Play()

Starts synthesizing voice from the text and plays the synthesized audio data.

Declaration
C#
Copy
public void Play()
Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Invalid State
  2. Operation Failure
  3. Out of Network
  4. Screen reader off
System.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 Client must be in the or state.
Postcondition: If this function succeeds, the Client will be in the state.
View Source

Prepare()

Connects to the TTS service asynchronously.

Declaration
C#
Copy
public void Prepare()
Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons while setting the value:

  1. Invalid state
  2. Screen reader off
System.NotSupportedException

This exception can be due to TTS not supported.

API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The Client must be in the state.
Postcondition: If this function is successful, the Client will be in the state. If this function is unsuccessful, ErrorOccurred event will be invoked.
View Source

Repeat()

Repeats the last added text.

Declaration
C#
Copy
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:

  1. Invalid State
  2. Operation Failure
  3. Screen reader off
System.NotSupportedException

This exception can be due to TTS not supported.

API Level: 10
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The Client must be in the state.
Postcondition: If this function succeeds, the Client will be in the state.
View Source

SetCredential(String)

Sets the application credential.

Declaration
C#
Copy
public void SetCredential(string credential)
Parameters
Type Name Description
System.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.

API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The Client must be in the or state.
View Source

SetPrivateData(String, String)

Sets the private data to tts engine.

Declaration
C#
Copy
public void SetPrivateData(string key, string data)
Parameters
Type Name Description
System.String key

The key string.

System.String data

The data string.

Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Invalid State
  2. Engine Not found
  3. Operation Failure
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.

API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The Client must be in the state.
View Source

Stop()

Stops playing the utterance and clears the queue.

Declaration
C#
Copy
public void Stop()
Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Invalid Stat
  2. Operation Failure
  3. Screen reader off
System.NotSupportedException

This exception can be due to TTS not supported.

API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The Client must be in the , , or state.
Postcondition: If this function succeeds, the Client will be in the state. This function will remove all text added via AddText() and synthesized sound data.
View Source

Unprepare()

Disconnects from the TTS service.

Declaration
C#
Copy
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.

API Level: 3
Feature: http://tizen.org/feature/speech.synthesis
Precondition: The Client must be in the state.
Postcondition: If this function is successful, the Client will be in the state.

Events

View Source

DefaultVoiceChanged

Event to be invoked when an error occurs.

Declaration
C#
Copy
public event EventHandler<DefaultVoiceChangedEventArgs> DefaultVoiceChanged
Event Type
Type Description
System.EventHandler<DefaultVoiceChangedEventArgs>
API Level: 3
View Source

EngineChanged

Event to be invoked to detect engine change.

Declaration
C#
Copy
public event EventHandler<EngineChangedEventArgs> EngineChanged
Event Type
Type Description
System.EventHandler<EngineChangedEventArgs>
API Level: 3
View Source

ErrorOccurred

Event to be invoked when an error occurs.

Declaration
C#
Copy
public event EventHandler<ErrorOccurredEventArgs> ErrorOccurred
Event Type
Type Description
System.EventHandler<ErrorOccurredEventArgs>
API Level: 4
View Source

ScreenReaderChanged

Event to be invoked to detect screen reader status change.

Declaration
C#
Copy
public event EventHandler<ScreenReaderChangedEventArgs> ScreenReaderChanged
Event Type
Type Description
System.EventHandler<ScreenReaderChangedEventArgs>
API Level: 9
View Source

ServiceStateChanged

Event to be invoked when the state of TTS service changes.

Declaration
C#
Copy
public event EventHandler<ServiceStateChangedEventArgs> ServiceStateChanged
Event Type
Type Description
System.EventHandler<ServiceStateChangedEventArgs>
API Level: 10
View Source

StateChanged

Event to be invoked when TTS state changes.

Declaration
C#
Copy
public event EventHandler<StateChangedEventArgs> StateChanged
Event Type
Type Description
System.EventHandler<StateChangedEventArgs>
API Level: 3
View Source

UtteranceCompleted

Event to be invoked when the utterance completes.

Declaration
C#
Copy
public event EventHandler<UtteranceEventArgs> UtteranceCompleted
Event Type
Type Description
System.EventHandler<UtteranceEventArgs>
API Level: 3
View Source

UtteranceStarted

Event to be invoked when the utterance starts.

Declaration
C#
Copy
public event EventHandler<UtteranceEventArgs> UtteranceStarted
Event Type
Type Description
System.EventHandler<UtteranceEventArgs>
API Level: 3

Implements

System.IDisposable