KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
UVoiceConversationSystem.h
이 파일의 문서화 페이지로 가기
1// Copyright (c) 2025 Doppleddiggong. All rights reserved. Unauthorized copying, modification, or distribution of this file, via any medium is strictly prohibited. Proprietary and confidential.
2
5#pragma once
6
7#include "CoreMinimal.h"
8#include "NetworkData.h"
9#include "AudioCapture.h"
10#include "Components/ActorComponent.h"
11#include "UVoiceConversationSystem.generated.h"
12
13UCLASS(Blueprintable, BlueprintType, ClassGroup=(Voice), meta=(BlueprintSpawnableComponent))
14class ONEPIECE_API UVoiceConversationSystem : public UActorComponent
15{
16 GENERATED_BODY()
17
18public:
20 UVoiceConversationSystem();
21
22protected:
24 virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
25
26public:
29 void InitSystem(class APlayerActor* InOwner);
30
32 UFUNCTION(BlueprintCallable, Category = "Voice|Conversation")
33 void StartRecording();
34
36 UFUNCTION(BlueprintCallable, Category = "Voice|Conversation")
37 void StopRecording();
38
42 UFUNCTION(BlueprintCallable, Category = "Voice|Conversation")
43 bool PlayVoiceAudio(const TArray<uint8>& AudioData);
44
46 UFUNCTION()
47 void OnVoiceAudioFinished();
48
50 UFUNCTION(BlueprintPure, Category = "Voice|Conversation")
51 bool IsRecording() const { return bIsRecording; }
52
53private:
59 void HandleOnCapture(const float* InAudio, int32 InNumFrames, int32 InNumChannels, int32 InSampleRate);
60
61 UFUNCTION()
62 void OnResponseSpeakingsJudges(FResponseSpeakingJudes& Response, bool bSuccess);
63
64 UFUNCTION()
65 void OnResponseChatAnswers(FResponseChatAnswers& Response, bool bSuccess);
66
67private:
68 UPROPERTY()
69 TObjectPtr<class APlayerActor> Owner;
70
71 UPROPERTY()
72 TObjectPtr<class UBroadcastManager> BroadcastManager;
73
74 // --- 녹음 관련 변수 ---
75 TUniquePtr<Audio::FAudioCapture> AudioCapture;
76
77 TArray<uint8> WAVData;
78 TArray<uint8> PCMData;
79
80 int32 LastSampleRate = 16000;
81 int32 LastNumChannels = 1;
82 FString LastRecordedFilePath;
83
84 // --- 상태 변수 ---
85 bool bIsRecording = false;
86 bool bIsProcessing = false;
87
89 UPROPERTY()
90 TObjectPtr<class UAudioComponent> CurVoiceAudio;
91
93 FTimerHandle VoiceFinishTimerHandle;
94};
네트워크 요청과 응답에 사용되는 구조체 및 설정을 정의합니다.
Main character driven directly by the player.
게임 내 전역 이벤트를 중계하는 중앙 이벤트 버스(Event Bus) 서브시스템입니다.
Chat Answers 응답 구조체입니다.
Speaking Questions 응답 구조체입니다.