UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DelayStereo.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "DSP/Delay.h"
7#include "DSP/Filter.h"
8
9namespace Audio
10{
11 // The different stereo delay modes
12 namespace EStereoDelayMode
13 {
22 }
23
25 {
26 public:
29
30 // Initializes the stereo delay with given sample rate and default max delay length
31 SIGNALPROCESSING_API void Init(const float InSampleRate, const int32 InNumChannels, const float InDelayLengthSec = 2.0f);
32
33 // Resets the stereo delay state
35
36 // Process a single frame of audio
37 SIGNALPROCESSING_API void ProcessAudioFrame(const float* InFrame, float* OutFrame);
38
39 // Process a buffer of audio
40 SIGNALPROCESSING_API void ProcessAudio(const float* InBuffer, const int32 InNumSamples, float* OutBuffer);
41
42 // Sets which delay stereo mode to use
44
45 // Gets the current stereo dealy mode
47
48 // Sets the delay time in msec.
50
51 // Sets the feedback amount
53
54 // Sets the delay ratio (scales difference between left and right stereo delays)
56
57 // Sets the amount of the effect to mix in the output
58 SIGNALPROCESSING_API void SetWetLevel(const float InWetLevel);
59
60 // Sets the amount of the effect to mix in the output
61 SIGNALPROCESSING_API void SetDryLevel(const float InDryLevel);
62
63 // Sets whether or not the filter is enabled
65
66 // Sets the filter settings
68
69 protected:
70 // Updates the delays based on recent parameters
72
73 // Delay lines per channel
75
76 // Biquad filter per channel to feed the delay output through
78
79 // What mode the stereo delay is in
81
82 // Amount of delay time in msec
83 float DelayTimeMsec = 0.0f;
84
85 // How much delay feedback to use
86 float Feedback = 0.0f;
87
88 // How much to shift the delays from each other
89 float DelayRatio = 0.0f;
90
91 // The amount of wet level on the output
92 float WetLevel = 0.0f;
93
94 // The amount of dry level on the output
95 float DryLevel = 1.0f;
96
97 // Filter data
98 float FilterFreq = 20000.0f;
99 float FilterQ = 2.0f;
101
102 // The number of channels to use (will sum mono)
104
105 // If the delay has started processing yet
106 bool bIsInit = true;
107
108 bool bIsFilterEnabled = false;
109 };
110
111}
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
Definition DelayStereo.h:25
SIGNALPROCESSING_API void UpdateDelays()
Definition DelayStereo.cpp:89
EBiquadFilter::Type FilterType
Definition DelayStereo.h:100
SIGNALPROCESSING_API void ProcessAudio(const float *InBuffer, const int32 InNumSamples, float *OutBuffer)
Definition DelayStereo.cpp:169
SIGNALPROCESSING_API FDelayStereo()
Definition DelayStereo.cpp:7
SIGNALPROCESSING_API void SetMode(const EStereoDelayMode::Type InMode)
Definition DelayStereo.cpp:15
float DryLevel
Definition DelayStereo.h:95
TArray< FDelay > Delays
Definition DelayStereo.h:74
SIGNALPROCESSING_API void SetDelayTimeMsec(const float InDelayTimeMsec)
Definition DelayStereo.cpp:20
SIGNALPROCESSING_API void SetFeedback(const float InFeedback)
Definition DelayStereo.cpp:26
float Feedback
Definition DelayStereo.h:86
SIGNALPROCESSING_API void SetFilterEnabled(bool bInEnabled)
Definition DelayStereo.cpp:47
float DelayRatio
Definition DelayStereo.h:89
SIGNALPROCESSING_API ~FDelayStereo()
Definition DelayStereo.cpp:11
int32 NumChannels
Definition DelayStereo.h:103
float DelayTimeMsec
Definition DelayStereo.h:83
SIGNALPROCESSING_API void SetDryLevel(const float InDryLevel)
Definition DelayStereo.cpp:42
EStereoDelayMode::Type GetMode() const
Definition DelayStereo.h:46
SIGNALPROCESSING_API void Reset()
Definition DelayStereo.cpp:80
TArray< FBiquadFilter > BiquadFilters
Definition DelayStereo.h:77
EStereoDelayMode::Type DelayMode
Definition DelayStereo.h:80
float FilterQ
Definition DelayStereo.h:99
SIGNALPROCESSING_API void SetFilterSettings(EBiquadFilter::Type InFilterType, const float InCutoffFrequency, const float InQ)
Definition DelayStereo.cpp:52
SIGNALPROCESSING_API void SetWetLevel(const float InWetLevel)
Definition DelayStereo.cpp:37
bool bIsFilterEnabled
Definition DelayStereo.h:108
SIGNALPROCESSING_API void ProcessAudioFrame(const float *InFrame, float *OutFrame)
Definition DelayStereo.cpp:103
float WetLevel
Definition DelayStereo.h:92
bool bIsInit
Definition DelayStereo.h:106
SIGNALPROCESSING_API void SetDelayRatio(const float InDelayRatio)
Definition DelayStereo.cpp:31
float FilterFreq
Definition DelayStereo.h:98
Definition Array.h:670
Type
Definition Filter.h:16
@ Lowpass
Definition Filter.h:17
Type
Definition DelayStereo.h:15
@ PingPong
Definition DelayStereo.h:18
@ NumStereoDelayModes
Definition DelayStereo.h:20
@ Cross
Definition DelayStereo.h:17
@ Normal
Definition DelayStereo.h:16
NO_LOGGING.
Definition AudioMixerPlatformAndroid.cpp:53