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>
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. | |
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.
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.
fullUrl | The full URL to download the audio data from (VoxtaServer REST API). |
lipSyncType | The type of lipsync data to generate for this chunk. |
A2FRestHandler | Weak pointer to the A2F REST handler (required for A2F lipsync). |
callback | Callback to invoke on state transitions. |
id | Index 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.
|
virtualdefault |
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.
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.
MessageChunkState MessageChunkAudioContainer::GetCurrentState | ( | ) | const |
|
inline |
Get an immutable pointer to the lipsync data object for this chunk, cast to the requested type.
T | Must derive from ILipSyncBaseData. |
const TArray< uint8 > & MessageChunkAudioContainer::GetRawAudioData | ( | ) | const |
Get a reference to the raw audio data bytes for this chunk.
Note: Main use-case is for custom lipsync, where blueprints could want access to the bytes to do whatever custom logic.
UImportedSoundWave * MessageChunkAudioContainer::GetSoundWave | ( | ) | const |
Note: UE requires a non-const pointer to play, which is why this doesn't return an immutable pointer.
const int MessageChunkAudioContainer::INDEX |
The index of this sound asset in the collection of the VoxtaAudioPlayback.
const LipSyncType MessageChunkAudioContainer::LIP_SYNC_TYPE |
The type of lipsync that this voiceline instance will support with its data.