Refactoring
This commit is contained in:
+3
-2
@@ -364,12 +364,12 @@ void UQwenTTSStreamingComponent::HandleAudioBase64(int32 Index, const FString& A
|
||||
DecodedChunk.NumChannels,
|
||||
DecodedChunk.PCM.Num());
|
||||
|
||||
if (Settings && Settings->bAutoPlayOnFirstChunk && !bPlaybackStarted)
|
||||
if (Settings && Settings->bAutoPlayOnFirstChunk && (!bPlaybackStarted || !IsPlaying()))
|
||||
{
|
||||
SetSound(ProceduralSoundWave);
|
||||
Play();
|
||||
bPlaybackStarted = true;
|
||||
UE_LOG(LogQwenTTSStreaming, Log, TEXT("Qwen TTS playback started on first chunk. Index=%d"), Index);
|
||||
UE_LOG(LogQwenTTSStreaming, Log, TEXT("Qwen TTS playback started/resumed on chunk. Index=%d"), Index);
|
||||
}
|
||||
|
||||
FQwenTTSStreamChunk Chunk;
|
||||
@@ -378,6 +378,7 @@ void UQwenTTSStreamingComponent::HandleAudioBase64(int32 Index, const FString& A
|
||||
Chunk.SampleRate = DecodedChunk.SampleRate;
|
||||
Chunk.NumChannels = DecodedChunk.NumChannels;
|
||||
Chunk.PCMBytes = DecodedChunk.PCM.Num();
|
||||
Chunk.PCMData = DecodedChunk.PCM;
|
||||
OnAudioChunk.Broadcast(Chunk);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,9 @@ struct QWENTTSSTREAMING_API FQwenTTSStreamChunk
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Qwen TTS")
|
||||
int32 PCMBytes = 0;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Qwen TTS")
|
||||
TArray<uint8> PCMData;
|
||||
};
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FQwenTTSStreamChunkDelegate, const FQwenTTSStreamChunk&, Chunk);
|
||||
|
||||
Reference in New Issue
Block a user