UnrealVoxta 0.1.1
 
Loading...
Searching...
No Matches
MessageChunkAudioContainer Class Reference

MessageChunkAudioContainer Internal utility class that encapsulates the download, decoding, and lipsync data generation for a single audio chunk (voiceline) of an AI character. More...

#include <MessageChunkAudioContainer.h>

Inheritance diagram for MessageChunkAudioContainer:

Public Member Functions

 MessageChunkAudioContainer (const FString &fullUrl, LipSyncType lipSyncType, TWeakPtr< Audio2FaceRESTHandler > A2FRestHandler, TFunction< void(const MessageChunkAudioContainer *newState)> callback, int id)
 Construct a new MessageChunkAudioContainer for a specific audio chunk.
 
virtual ~MessageChunkAudioContainer ()=default
 
void Continue ()
 Advance the internal state machine to the next processing step (download, decode, lipsync, etc).
 
void CleanupData ()
 Clean up all dynamically created objects and data, and mark this chunk as cleaned up.
 
const TArray< uint8 > & GetRawAudioData () const
 Get a reference to the raw audio data bytes for this chunk.
 
template<typename T, typename = std::enable_if_t<std::is_base_of_v<ILipSyncBaseData, T>>>
const T * GetLipSyncData () const
 Get an immutable pointer to the lipsync data object for this chunk, cast to the requested type.
 
MessageChunkState GetCurrentState () const
 
UImportedSoundWave * GetSoundWave () const
 

Public Attributes

const int INDEX
 The index of this sound asset in the collection of the VoxtaAudioPlayback.
 
const LipSyncType LIP_SYNC_TYPE
 The type of lipsync that this voiceline instance will support with its data.
 

Detailed Description

MessageChunkAudioContainer Internal utility class that encapsulates the download, decoding, and lipsync data generation for a single audio chunk (voiceline) of an AI character.

Handles async download from the VoxtaServer REST API, conversion to a playable sound wave, and optional lipsync data generation (A2F, OVR, or custom).

The object manages its own state machine and notifies a callback on state transitions. Not a UObject; must be managed via shared pointers.

Constructor & Destructor Documentation

◆ MessageChunkAudioContainer()

MessageChunkAudioContainer::MessageChunkAudioContainer ( const FString & fullUrl,
LipSyncType lipSyncType,
TWeakPtr< Audio2FaceRESTHandler > A2FRestHandler,
TFunction< void(const MessageChunkAudioContainer *newState)> callback,
int id )

Construct a new MessageChunkAudioContainer for a specific audio chunk.

Parameters
fullUrlThe full URL to download the audio data from (VoxtaServer REST API).
lipSyncTypeThe type of lipsync data to generate for this chunk.
A2FRestHandlerWeak pointer to the A2F REST handler (required for A2F lipsync).
callbackCallback to invoke on state transitions.
idIndex of this chunk in the parent VoxtaAudioPlayback's chunk list.

TODO: avoid requiring the A2FRestHandler injection, I kinda wanna move it to main subsystem but idk yet.

◆ ~MessageChunkAudioContainer()

virtual MessageChunkAudioContainer::~MessageChunkAudioContainer ( )
virtualdefault

Member Function Documentation

◆ CleanupData()

void MessageChunkAudioContainer::CleanupData ( )

Clean up all dynamically created objects and data, and mark this chunk as cleaned up.

After this call, the chunk cannot be used again.

◆ Continue()

void MessageChunkAudioContainer::Continue ( )

Advance the internal state machine to the next processing step (download, decode, lipsync, etc).

Should be called when the previous step is complete.

◆ GetCurrentState()

MessageChunkState MessageChunkAudioContainer::GetCurrentState ( ) const
Returns
The current state of this instance.

◆ GetLipSyncData()

template<typename T, typename = std::enable_if_t<std::is_base_of_v<ILipSyncBaseData, T>>>
const T * MessageChunkAudioContainer::GetLipSyncData ( ) const
inline

Get an immutable pointer to the lipsync data object for this chunk, cast to the requested type.

Template Parameters
TMust derive from ILipSyncBaseData.
Returns
Pointer to the lipsync data object, or nullptr if not available.

◆ GetRawAudioData()

const TArray< uint8 > & MessageChunkAudioContainer::GetRawAudioData ( ) const

Get a reference to the raw audio data bytes for this chunk.

Returns
Immutable reference to the raw audio data.

Note: Main use-case is for custom lipsync, where blueprints could want access to the bytes to do whatever custom logic.

◆ GetSoundWave()

UImportedSoundWave * MessageChunkAudioContainer::GetSoundWave ( ) const
Returns
The pointer to the generated SoundWave, tied to this instance.

Note: UE requires a non-const pointer to play, which is why this doesn't return an immutable pointer.

Member Data Documentation

◆ INDEX

const int MessageChunkAudioContainer::INDEX

The index of this sound asset in the collection of the VoxtaAudioPlayback.

◆ LIP_SYNC_TYPE

const LipSyncType MessageChunkAudioContainer::LIP_SYNC_TYPE

The type of lipsync that this voiceline instance will support with its data.


The documentation for this class was generated from the following files: