UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SoundEffectSource.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "CoreMinimal.h"
6#include "IAudioModulation.h"
11
12#include "SoundEffectSource.generated.h"
13
16
18UCLASS(config = Engine, abstract, editinlinenew, BlueprintType, MinimalAPI)
20{
22
23public:
24 static constexpr int32 DefaultSupportedChannels = 2;
25
26 virtual int32 GetMaxSupportedChannels() const { return DefaultSupportedChannels; }
27};
28
29USTRUCT(BlueprintType)
31{
33
34 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SourceEffect")
36
37 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SourceEffect")
38 uint32 bBypass:1;
39
41 : Preset(nullptr)
42 , bBypass(false)
43 {}
44};
45
47UCLASS(BlueprintType, MinimalAPI)
49{
51
52public:
53
55 UPROPERTY(EditAnywhere, Category = "SourceEffect")
57
59 UPROPERTY(EditAnywhere, Category = Effects)
60 uint32 bPlayEffectChainTails : 1;
61
62 ENGINE_API void AddReferencedEffects(FReferenceCollector& Collector);
63
65 int32 ENGINE_API GetSupportedChannelCount() const;
66
67 bool ENGINE_API SupportsChannelCount(const int32 InNumChannels) const;
68
70
71#if WITH_EDITOR
72 ENGINE_API virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
73#endif
74
75};
76
79{
80 // Sample rate of the audio renderer this effect is processing on
81 float SampleRate = 0.0f;
82
83 // The number of channels of the source audio that is fed into the source effect
85
86 // The audio clock of the audio renderer this effect is processing on
87 double AudioClock = 0.0;
88
89 // The object id of the parent preset
91
92 // The audio device ID of the audio device instance this source instance was created from
94};
95
117
119{
120public:
121 virtual ~FSoundEffectSource() = default;
122
123 // Called by the audio engine or systems internally. This function calls the virtual Init function implemented by derived classes.
125 {
126 // Store the init data internally
127 InitData_Internal = InInitData;
128
129 // This may have been set before this call, so set it on the init data struct
131 {
132 InitData_Internal.ParentPresetUniqueId = ParentPresetUniqueId;
133 }
134 // Call the virtual function
135 Init(InitData_Internal);
136 }
137
138 // Returns the data that was given to the source effect when initialized.
140 {
141 // Return our copy of the initialization data
142 return InitData_Internal;
143 }
144
145 // Process the input block of audio. Called on audio thread.
147
148 friend class USoundEffectPreset;
149
150private:
151 // Called on an audio effect at initialization on main thread before audio processing begins.
152 virtual void Init(const FSoundEffectSourceInitData& InInitData) = 0;
153
154 // Copy of data used to initialize the source effect.
155 // Can result in init being called again if init conditions have changed (Sample rate changed, channel count changed, etc)
156 FSoundEffectSourceInitData InitData_Internal;
157};
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
void Init()
Definition LockFreeList.h:4
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UCLASS(...)
Definition ObjectMacros.h:776
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Engine.Build.cs:7
Definition UObjectGlobals.h:2492
Definition SoundEffectBase.h:72
TWeakObjectPtr< USoundEffectPreset > Preset
Definition SoundEffectBase.h:110
uint32 ParentPresetUniqueId
Definition SoundEffectBase.h:111
Definition SoundEffectSource.h:119
void Setup(const FSoundEffectSourceInitData &InInitData)
Definition SoundEffectSource.h:124
virtual void ProcessAudio(const FSoundEffectSourceInputData &InData, float *OutAudioBufferData)=0
virtual ~FSoundEffectSource()=default
const FSoundEffectSourceInitData & GetInitializedData() const
Definition SoundEffectSource.h:139
Definition Array.h:670
Definition Object.h:95
Definition SoundEffectPreset.h:24
Definition SoundEffectSource.h:49
Definition SoundEffectSource.h:20
virtual int32 GetMaxSupportedChannels() const
Definition SoundEffectSource.h:26
@ false
Definition radaudio_common.h:23
Definition UnrealType.h:6865
Definition SoundEffectSource.h:79
int32 NumSourceChannels
Definition SoundEffectSource.h:84
uint32 ParentPresetUniqueId
Definition SoundEffectSource.h:90
uint32 AudioDeviceId
Definition SoundEffectSource.h:93
float SampleRate
Definition SoundEffectSource.h:81
double AudioClock
Definition SoundEffectSource.h:87
Definition SoundEffectSource.h:98
double AudioClock
Definition SoundEffectSource.h:101
float CurrentPitch
Definition SoundEffectSource.h:100
float * InputSourceEffectBufferPtr
Definition SoundEffectSource.h:104
float CurrentVolume
Definition SoundEffectSource.h:99
float CurrentPlayFraction
Definition SoundEffectSource.h:102
FSpatializationParams SpatParams
Definition SoundEffectSource.h:103
FSoundEffectSourceInputData()
Definition SoundEffectSource.h:107
int32 NumSamples
Definition SoundEffectSource.h:105
Definition SoundEffectSource.h:31
Definition IAudioExtensionPlugin.h:69
Definition ObjectPtr.h:488