ITextToSpeech
Reference the ITextToSpeech interface for text-to-speech functionality.
Read time 4 minutesLast updated 2 days ago
An interface for events and methods related to text-to-speech (TTS).
#include <ITextToSpeech.h>Public Functions
Name | |
|---|---|
| DECLARE_EVENT_ThreeParams(ITextToSpeech , PlaybackStarted , unsigned int , const ITTSMessage & , double ) | |
| DECLARE_EVENT_TwoParams(ITextToSpeech , PlaybackCompleted , unsigned int , const ITTSMessage & ) | |
| DECLARE_EVENT_TwoParams(ITextToSpeech , PlaybackFailed , VivoxCoreError , const ITTSMessage & ) | |
| virtual const TMap< FString, ITTSVoice * > & | GetAvailableVoices() =0 All voices available to the text-to-speech subsystem for speech synthesis, indexed by name. |
| virtual const ITTSVoice & | GetCurrentVoice() =0 The voice used by text-to-speech methods called from this ILoginSession. |
| virtual bool | SetCurrentVoice(const ITTSVoice & newVoice) =0 Set the voice used by text-to-speech methods called from this ILoginSession. |
| virtual VivoxCoreError | Speak(const FString & text, const TTSDestination & destination, ITTSMessage ** outMessage =nullptr) =0 Inject a new text-to-speech (TTS) message into the specified destination. |
| virtual VivoxCoreError | SpeakToBuffer(const FString & text, ITTSAudioBuffer ** outBuffer) =0 Inject a new text-to-speech message into an audio buffer for direct use. |
| virtual VivoxCoreError | CancelMessage(const ITTSMessage & message) =0 Cancel a single currently playing or enqueued text-to-speech message. |
| virtual VivoxCoreError | CancelDestination(const TTSDestination & destination) =0 Cancel all text-to-speech messages in a destination (ongoing and enqueued). |
| virtual VivoxCoreError | CancelAll() =0 Cancel all text-to-speech messages (ongoing and enqueued) from all destinations. |
| virtual const TArray< ITTSMessage * > & | GetMessages(const TTSDestination & destination) =0 Retrieve ongoing or enqueued text-to-speech (TTS) messages that were previously created by using Speak(). |
Public Attributes
Name | |
|---|---|
| PlaybackStarted | EventPlaybackStarted An event that indicates a text-to-speech (TTS) message has finished preparing for playback and is starting to play. |
| PlaybackCompleted | EventPlaybackCompleted An event that indicates a text-to-speech (TTS) message has finished playback. |
| PlaybackFailed | EventPlaybackFailed An event that indicates playback of a text-to-speech message has failed. |
Public Functions Documentation
function DECLARE_EVENT_ThreeParams
DECLARE_EVENT_ThreeParams( ITextToSpeech , PlaybackStarted , unsigned int , const ITTSMessage & , double )
function DECLARE_EVENT_TwoParams
DECLARE_EVENT_TwoParams( ITextToSpeech , PlaybackCompleted , unsigned int , const ITTSMessage & )
function DECLARE_EVENT_TwoParams
DECLARE_EVENT_TwoParams( ITextToSpeech , PlaybackFailed , VivoxCoreError , const ITTSMessage & )
function GetAvailableVoices
All voices available to the text-to-speech subsystem for speech synthesis, indexed by name.virtual const TMap< FString, ITTSVoice * > & GetAvailableVoices() =0
function GetCurrentVoice
The voice used by text-to-speech methods called from this ILoginSession. Return: The voice previously set with SetCurrentVoice(), or the SDK default voice if never set.virtual const ITTSVoice & GetCurrentVoice() =0
function SetCurrentVoice
Set the voice used by text-to-speech methods called from this ILoginSession. Parameters:virtual bool SetCurrentVoice( const ITTSVoice & newVoice) =0
- newVoice A valid ITTSVoice obtained from GetAvailableVoices() to use as this user's voice.
function Speak
Inject a new text-to-speech (TTS) message into the specified destination. Parameters:virtual VivoxCoreError Speak( const FString & text, const TTSDestination & destination, ITTSMessage ** outMessage =nullptr) =0
- text The text to be converted into speech.
- destination Determines the output stream and mechanism for TTS injection.
- outMessage [out, optional] An object that holds properties related to this TTS message.
function SpeakToBuffer
Inject a new text-to-speech message into an audio buffer for direct use. Parameters:virtual VivoxCoreError SpeakToBuffer( const FString & text, ITTSAudioBuffer ** outBuffer) =0
- text The text to be converted into speech.
- outBuffer [out] An object that contains raw audio data and metadata, such as buffer length and audio format properties.
function CancelMessage
Cancel a single currently playing or enqueued text-to-speech message. Parameters:virtual VivoxCoreError CancelMessage( const ITTSMessage & message) =0
- message The ITTSMessage to cancel.
function CancelDestination
Cancel all text-to-speech messages in a destination (ongoing and enqueued). Parameters:virtual VivoxCoreError CancelDestination( const TTSDestination & destination) =0
- destination The TTSDestination to clear of messages.
function CancelAll
Cancel all text-to-speech messages (ongoing and enqueued) from all destinations.virtual VivoxCoreError CancelAll() =0
function GetMessages
Retrieve ongoing or enqueued text-to-speech (TTS) messages that were previously created by using Speak(). Parameters:virtual const TArray< ITTSMessage * > & GetMessages( const TTSDestination & destination) =0
- destination The TTSDestination to retrieve messages for.
Public Attributes Documentation
variable EventPlaybackStarted
An event that indicates a text-to-speech (TTS) message has finished preparing for playback and is starting to play. Parameters:PlaybackStarted EventPlaybackStarted;
- numConsumers The number of active sessions (for remote playback destinations), local players (for local playback destinations), or both, that the TTS message is playing into.
- message The ITTSMessage that corresponds to this speech.
- messageDuration The duration of the synthesized voice clip in seconds.
variable EventPlaybackCompleted
An event that indicates a text-to-speech (TTS) message has finished playback. Parameters:PlaybackCompleted EventPlaybackCompleted;
- numConsumers The number of active sessions (for remote playback destinations), local players (for local playback destinations), or both, that the TTS message is playing into.
- message The ITTSMessage that corresponds to this speech.
variable EventPlaybackFailed
An event that indicates playback of a text-to-speech message has failed. Parameters:PlaybackFailed EventPlaybackFailed;
- status The error code of the failure.
- message The ITTSMessage that corresponds to this speech.