docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TTSMessage

    A message to be spoken in the text-to-speech (TTS) subsystem.

    Inheritance
    object
    TTSMessage
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: VivoxUnity
    Assembly: VivoxUnity.dll
    Syntax
    public sealed class TTSMessage

    Constructors

    TTSMessage(string, TTSDestination)

    Create a new TTS message in the NotEnqueued state.

    Declaration
    public TTSMessage(string text, TTSDestination destination)
    Parameters
    Type Name Description
    string text

    The text to be synthesized into speech.

    TTSDestination destination
    Remarks

    To synthesize this text into speech and inject it into the destination, use ILoginSession.TTS.Speak() or ILoginSession.TTS.Messages.Enqueue().

    Properties

    Destination

    The destination of this message.

    Declaration
    public TTSDestination Destination { get; }
    Property Value
    Type Description
    TTSDestination

    Duration

    The duration of the synthesized voice clip in seconds.

    Declaration
    public double Duration { get; }
    Property Value
    Type Description
    double
    Remarks

    Duration is set when playback starts, and is always 0.0 until that occurs.

    NumConsumers

    The number of active sessions (for remote playback destinations), local players (for local playback destinations), or both that the text-to-speech (TTS) message is playing into.

    Declaration
    public uint NumConsumers { get; }
    Property Value
    Type Description
    uint
    Remarks

    NumConsumers is set when playback starts, and is always 0 until that occurs.

    State

    The Playing/Enqueued state of the message.

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

    Text

    The text to be synthesized into speech.

    Declaration
    public string Text { get; }
    Property Value
    Type Description
    string

    Voice

    The voice used to synthesize this message.

    Declaration
    public ITTSVoice Voice { get; }
    Property Value
    Type Description
    ITTSVoice

    Methods

    Cancel()

    Cancel the message if it is Playing or Enqueued.

    Declaration
    public void Cancel()

    Equals(object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj
    Returns
    Type Description
    bool
    Overrides
    object.Equals(object)

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    object.GetHashCode()

    Speak(ILoginSession)

    Inject a new text-to-speech (TTS) message as the supplied user.

    Declaration
    public void Speak(ILoginSession userSpeaking)
    Parameters
    Type Name Description
    ILoginSession userSpeaking

    The local user that speaks the message.

    Remarks

    This method is a shortcut for userSpeaking.TTS.Speak(this).

    Events

    PropertyChanged

    Declaration
    public event PropertyChangedEventHandler PropertyChanged
    Event Type
    Type Description
    PropertyChangedEventHandler
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)