RealtimeStyleTransferRuntime/Source/LyraGame/Audio/LyraAudioMixEffectsSubsystem.h

112 lines
4.2 KiB
C
Raw Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
2022-09-13 07:18:28 +00:00
#include "Containers/Array.h"
#include "Engine/EngineTypes.h"
2022-05-23 18:41:30 +00:00
#include "Subsystems/WorldSubsystem.h"
2022-09-13 07:18:28 +00:00
#include "UObject/UObjectGlobals.h"
2022-05-23 18:41:30 +00:00
#include "LyraAudioMixEffectsSubsystem.generated.h"
2022-09-13 07:18:28 +00:00
class FSubsystemCollectionBase;
class UObject;
2022-05-23 18:41:30 +00:00
class USoundControlBus;
2022-09-13 07:18:28 +00:00
class USoundControlBusMix;
2022-05-23 18:41:30 +00:00
class USoundEffectSubmixPreset;
2022-09-13 07:18:28 +00:00
class USoundSubmix;
class UWorld;
2022-05-23 18:41:30 +00:00
USTRUCT()
struct FLyraAudioSubmixEffectsChain
{
GENERATED_BODY()
// Submix on which to apply the Submix Effect Chain Override
UPROPERTY(Transient)
2022-09-13 07:18:28 +00:00
TObjectPtr<USoundSubmix> Submix = nullptr;
2022-05-23 18:41:30 +00:00
// Submix Effect Chain Override (Effects processed in Array index order)
UPROPERTY(Transient)
2022-09-13 07:18:28 +00:00
TArray<TObjectPtr<USoundEffectSubmixPreset>> SubmixEffectChain;
2022-05-23 18:41:30 +00:00
};
/**
* This subsystem is meant to automatically engage default and user control bus mixes
* to retrieve previously saved user settings and apply them to the activated user mix.
* Additionally, this subsystem will automatically apply HDR/LDR Audio Submix Effect Chain Overrides
* based on the user's preference for HDR Audio. Submix Effect Chain Overrides are defined in the
* Lyra Audio Settings.
*/
UCLASS()
class LYRAGAME_API ULyraAudioMixEffectsSubsystem : public UWorldSubsystem
{
GENERATED_BODY()
public:
// USubsystem implementation Begin
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
virtual void Deinitialize() override;
// USubsystem implementation End
virtual bool ShouldCreateSubsystem(UObject* Outer) const override;
/** Called once all UWorldSubsystems have been initialized */
virtual void PostInitialize() override;
/** Called when world is ready to start gameplay before the game mode transitions to the correct state and call BeginPlay on all actors */
virtual void OnWorldBeginPlay(UWorld& InWorld) override;
/** Set whether the HDR Audio Submix Effect Chain Override settings are applied */
void ApplyDynamicRangeEffectsChains(bool bHDRAudio);
protected:
void OnLoadingScreenStatusChanged(bool bShowingLoadingScreen);
void ApplyOrRemoveLoadingScreenMix(bool bWantsLoadingScreenMix);
// Called when determining whether to create this Subsystem
virtual bool DoesSupportWorldType(const EWorldType::Type WorldType) const override;
// Default Sound Control Bus Mix retrieved from the Lyra Audio Settings
UPROPERTY(Transient)
2022-09-13 07:18:28 +00:00
TObjectPtr<USoundControlBusMix> DefaultBaseMix = nullptr;
2022-05-23 18:41:30 +00:00
// Loading Screen Sound Control Bus Mix retrieved from the Lyra Audio Settings
UPROPERTY(Transient)
2022-09-13 07:18:28 +00:00
TObjectPtr<USoundControlBusMix> LoadingScreenMix = nullptr;
2022-05-23 18:41:30 +00:00
// User Sound Control Bus Mix retrieved from the Lyra Audio Settings
UPROPERTY(Transient)
2022-09-13 07:18:28 +00:00
TObjectPtr<USoundControlBusMix> UserMix = nullptr;
2022-05-23 18:41:30 +00:00
// Overall Sound Control Bus retrieved from the Lyra Audio Settings and linked to the UI and game settings in LyraSettingsLocal
UPROPERTY(Transient)
2022-09-13 07:18:28 +00:00
TObjectPtr<USoundControlBus> OverallControlBus = nullptr;
2022-05-23 18:41:30 +00:00
// Music Sound Control Bus retrieved from the Lyra Audio Settings and linked to the UI and game settings in LyraSettingsLocal
UPROPERTY(Transient)
2022-09-13 07:18:28 +00:00
TObjectPtr<USoundControlBus> MusicControlBus = nullptr;
2022-05-23 18:41:30 +00:00
// SoundFX Sound Control Bus retrieved from the Lyra Audio Settings and linked to the UI and game settings in LyraSettingsLocal
UPROPERTY(Transient)
2022-09-13 07:18:28 +00:00
TObjectPtr<USoundControlBus> SoundFXControlBus = nullptr;
2022-05-23 18:41:30 +00:00
// Dialogue Sound Control Bus retrieved from the Lyra Audio Settings and linked to the UI and game settings in LyraSettingsLocal
UPROPERTY(Transient)
2022-09-13 07:18:28 +00:00
TObjectPtr<USoundControlBus> DialogueControlBus = nullptr;
2022-05-23 18:41:30 +00:00
// VoiceChat Sound Control Bus retrieved from the Lyra Audio Settings and linked to the UI and game settings in LyraSettingsLocal
UPROPERTY(Transient)
2022-09-13 07:18:28 +00:00
TObjectPtr<USoundControlBus> VoiceChatControlBus = nullptr;
2022-05-23 18:41:30 +00:00
// Submix Effect Chain Overrides to apply when HDR Audio is turned on
UPROPERTY(Transient)
TArray<FLyraAudioSubmixEffectsChain> HDRSubmixEffectChain;
// Submix Effect hain Overrides to apply when HDR Audio is turned off
UPROPERTY(Transient)
TArray<FLyraAudioSubmixEffectsChain> LDRSubmixEffectChain;
bool bAppliedLoadingScreenMix = false;
};