LEAP Documentation 40220
Documentation for the LEAP project
AnnouncerSubsystem.h
Go to the documentation of this file.
1// Copyright Blue Isle Studios Inc 2018. All Rights Reserved.
2#pragma once
3
4#include "CoreMinimal.h"
5#include "Subsystems/GameInstanceSubsystem.h"
6
8
9#include "Containers/Queue.h"
10#include "Components/AudioComponent.h"
11
12#include "AnnouncerSubsystem.generated.h"
13
14class UAudioComponent;
15
16DECLARE_DELEGATE(FAsyncBinding);
17DECLARE_DELEGATE_OneParam(FDelegateSoundCue, USoundCue*);
18
19UCLASS()
20class PROJECTX_API UAnnouncerSubsystem : public UGameInstanceSubsystem
21{
22 GENERATED_BODY()
23
24public:
25 UFUNCTION(BlueprintCallable, Category = "Voice")
26 void PlayVoice(FString const VoiceToPlay);
27
28 bool IsAnnouncerSpeaking();
29protected:
30 UFUNCTION()
31 void PlayNextQueuedVoice();
32
33 void AsyncLoadSound(TSoftObjectPtr<USoundCue> AssetPointer, FDelegateSoundCue Callback);
34
35 void PlayVoiceTrackInfo(FVoiceTrackInfo VoiceTrackInfo);
36
37 UFUNCTION()
38 void OnStartedTalking(const TArray<struct FSubtitleCue>& Subtitles, float CueDuration);
39protected:
40 TQueue<FVoiceTrackInfo> SoundsQueue;
41
42 UPROPERTY()
43 FVoiceTrackInfo CurrentVoiceInfo;
44
45 UPROPERTY()
46 UAudioComponent* ActiveVoiceAudioComponent = nullptr;
47 UPROPERTY()
48 UDialogueWidget* UserWidget = nullptr;
49
50 FDelegateSoundCue DelegateSoundCue;
51};
DECLARE_DELEGATE(FAsyncBinding)
DECLARE_DELEGATE_OneParam(FDelegateSoundCue, USoundCue *)
Definition: AnnouncerSubsystem.h:21
TQueue< FVoiceTrackInfo > SoundsQueue
Definition: AnnouncerSubsystem.h:40
Definition: DialogueWidget.h:11
Definition: AnnouncerSoundDataAsset.h:27