Class TtsClient

    Definition

    Namespace:
    Tizen.Uix.Tts
    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
    object
    TtsClient
    Implements
    System.IDisposable

    Constructors

    View Source

    TtsClient()

    Constructor to create a TTS instance.

    Declaration
    public TtsClient()
    Exceptions
    Type Condition
    System.InvalidOperationException

    This exception can be due to the following reasons:

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

    This exception can be due to out Of memory.

    System.NotSupportedException

    This exception can be due to TTS not supported.

    Properties

    View Source

    CurrentMode

    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:

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

    This exception can be due to out Of memory.

    System.NotSupportedException

    This exception can be due to TTS not supported.

    View Source

    CurrentState

    Gets the current TTS state.

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

    The current state of TTS.

    View Source

    DefaultVoice

    Gets the default voice set by the user.

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

    The default voice in TTS.

    View Source

    MaxTextSize

    Gets the maximum byte size for text.

    Declaration
    public uint MaxTextSize { get; }
    Property Value
    Type Description
    uint

    The Maximum byte size for text.

    Methods

    View Source

    AddText(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 based UTF-8.

    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 UTF-8 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
    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.

    View Source

    Dispose()

    Method to release resources.

    Declaration
    public void Dispose()
    View Source

    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.

    View Source

    ~TtsClient()

    Destructor to destroy TtsClient handle.

    Declaration
    protected ~TtsClient()
    View Source

    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:

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

    This exception can be due to TTS not supported.

    View Source

    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:

    1. Invalid State
    2. Operation Failure
    System.NotSupportedException

    This exception can be due to TTS not supported.

    View Source

    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:

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

    This exception can be due to TTS not supported.

    View Source

    Pause()

    Pauses the currently playing utterance.

    Declaration
    public void Pause()
    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.

    View Source

    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:

    1. Invalid State
    2. Operation Failure
    3. Out of Network
    System.NotSupportedException

    This exception can be due to TTS not supported.

    System.UnauthorizedAccessException

    This exception can be due to permission denied.

    View Source

    Prepare()

    Connects to the TTS service asynchronously.

    Declaration
    public void Prepare()
    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.

    View Source

    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.

    View Source

    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:

    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.

    View Source

    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:

    1. Invalid Stat
    2. Operation Failure
    System.NotSupportedException

    This exception can be due to TTS not supported.

    View Source

    Unprepare()

    Disconnects from the STT 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 Source

    DefaultVoiceChanged

    Event to be invoked when an error occurs.

    Declaration
    public event EventHandler<DefaultVoiceChangedEventArgs> DefaultVoiceChanged
    Event Type
    Type Description
    System.EventHandler<TEventArgs><DefaultVoiceChangedEventArgs>
    View Source

    EngineChanged

    Event to be invoked to detect engine change.

    Declaration
    public event EventHandler<EngineChangedEventArgs> EngineChanged
    Event Type
    Type Description
    System.EventHandler<TEventArgs><EngineChangedEventArgs>
    View Source

    ErrorOccurred

    Event to be invoked when an error occurs.

    Declaration
    public event EventHandler<ErrorOccurredEventArgs> ErrorOccurred
    Event Type
    Type Description
    System.EventHandler<TEventArgs><ErrorOccurredEventArgs>
    View Source

    StateChanged

    Event to be invoked when TTS state changes.

    Declaration
    public event EventHandler<StateChangedEventArgs> StateChanged
    Event Type
    Type Description
    System.EventHandler<TEventArgs><StateChangedEventArgs>
    View Source

    UtteranceCompleted

    Event to be invoked when the utterance completes.

    Declaration
    public event EventHandler<UtteranceEventArgs> UtteranceCompleted
    Event Type
    Type Description
    System.EventHandler<TEventArgs><UtteranceEventArgs>
    View Source

    UtteranceStarted

    Event to be invoked when the utterance starts.

    Declaration
    public event EventHandler<UtteranceEventArgs> UtteranceStarted
    Event Type
    Type Description
    System.EventHandler<TEventArgs><UtteranceEventArgs>

    Implements

    System.IDisposable
    • View Source
    Back to top Copyright © 2016-2024 Samsung
    Generated by DocFX