Class UTryllSpeakerComponent¶
ClassList > UTryllSpeakerComponent
#include <TryllSpeakerComponent.h>
Inherits the following classes: UActorComponent
Public Attributes¶
| Type | Name |
|---|---|
| FOnTryllTtsAudioFinished | OnTtsAudioFinished |
| FOnTryllTtsAudioStarted | OnTtsAudioStarted |
| FOnTryllTtsPcm | OnTtsPcm |
| FOnTryllTtsTurnStarted | OnTtsTurnStarted |
| FOnTryllTtsVisemes | OnTtsVisemes |
Public Functions¶
| Type | Name |
|---|---|
| float | GetOutputLatencyMs () const |
| TSharedRef< FTryllTtsPlaybackClock > | GetPlaybackClock () const |
| int32 | GetSampleRate () const |
| void | HandleAudio (const FString & NodeName, TArrayView< const int16 > Pcm) |
| void | HandleFormat (const FString & NodeName, uint32 SampleRate, uint16 Channels, uint16 BitsPerSample) |
| void | HandleTurnComplete () |
| void | HandleVisemes (const FString & NodeName, TArrayView< const FTryllVisemeEvent > Events) |
| void | StopPlayback () |
| UTryllSpeakerComponent () |
Protected Functions¶
| Type | Name |
|---|---|
| virtual void | BeginPlay () override |
| virtual void | EndPlay (const EEndPlayReason::Type EndPlayReason) override |
| virtual void | TickComponent (float DeltaTime, ELevelTick TickType, FActorComponentTickFunction * ThisTickFunction) override |
Detailed Description¶
Public Attributes Documentation¶
variable OnTtsAudioFinished¶
Fired when the turn has completed and its queued audio has been handed to the audio engine — the engine's own buffers (a few tens of ms) are still to play out. Also fired immediately by StopPlayback while speaking.
variable OnTtsAudioStarted¶
Fired once when the first PCM chunk of a turn is queued for playback. Always followed by exactly one OnTtsAudioFinished before it fires again.
variable OnTtsPcm¶
Fired on the game thread for each PCM chunk after it is queued for playback, as normalized float samples in [-1, 1]. The array is a reused scratch buffer — copy it if you need it beyond the callback.
variable OnTtsTurnStarted¶
Fired on the game thread when a turn's audio format is announced, before any of its audio is queued. TurnOriginSamples is the playback-clock position (GetPlaybackClock()->GetPlayedSamples() units) at which the turn's first sample will play; viseme offsets are relative to it.
variable OnTtsVisemes¶
Fired on the game thread for each viseme frame. The view is valid only during the callback.
Public Functions Documentation¶
function GetOutputLatencyMs¶
Audio engine output buffering after the playback clock's played count, in milliseconds. 0 without an audio device.
function GetPlaybackClock¶
function GetSampleRate¶
function HandleAudio¶
void UTryllSpeakerComponent::HandleAudio (
const FString & NodeName,
TArrayView< const int16 > Pcm
)
Called by UTryllAgentComponent for each PCM chunk in the current turn. The view references caller-owned memory and is consumed synchronously. NodeName is accepted for signature compatibility (see HandleFormat) but unused.
function HandleFormat¶
void UTryllSpeakerComponent::HandleFormat (
const FString & NodeName,
uint32 SampleRate,
uint16 Channels,
uint16 BitsPerSample
)
Called by UTryllAgentComponent when the server announces the audio format for the current turn. (Re)creates the procedural sound if the sample rate differs from the previous turn's. NodeName (the producing node's name — multi-sender attribution) is accepted for signature compatibility with FTryllAgent::OnTtsAudioFormat but otherwise unused: this component mixes all producers into one procedural sound.
function HandleTurnComplete¶
Called by UTryllAgentComponent when no more audio is coming for the current turn: on TurnComplete, and when the agent is destroyed or the connection drops.
function HandleVisemes¶
void UTryllSpeakerComponent::HandleVisemes (
const FString & NodeName,
TArrayView< const FTryllVisemeEvent > Events
)
Called by UTryllAgentComponent for each viseme frame (one per synthesized sentence, when the agent's voice profile has Emit Visemes on). Re-broadcast on OnTtsVisemes so lip sync needs only this speaker: it already owns the audio and the playback clock the track is timed against.
function StopPlayback¶
Cancels the current playback: drops all queued audio and ignores further audio until the next turn announces its audio format. Fires OnTtsAudioFinished if speech was playing. Does not cancel the agent's turn — call Cancel on the agent for that. Safe to call repeatedly and when nothing is playing.
function UTryllSpeakerComponent¶
Protected Functions Documentation¶
function BeginPlay¶
function EndPlay¶
function TickComponent¶
virtual void UTryllSpeakerComponent::TickComponent (
float DeltaTime,
ELevelTick TickType,
FActorComponentTickFunction * ThisTickFunction
) override
The documentation for this class was generated from the following file C:/_tryll/_monorepo3/tryll/clients/unreal/Source/TryllClient/Public/TryllSpeakerComponent.h