UDocumentation
UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
BiQuadFilter.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/Dsp.h
"
7
8
namespace
Audio
9
{
10
// Simple biquad filter structure handling a biquad formulation
11
// See: https://en.wikipedia.org/wiki/Digital_biquad_filter
12
// Calculations of coefficients are handled outside this class.
13
// Filter coefficients are public and are intended to be used externally.
14
class
UE_DEPRECATED
(5.5,
"Audio::FBiquad is deprecated in favor of Audio::FBiquadFilter due to performance issues"
)
FBiquad
15
{
16
public
:
17
FBiquad
()
18
: A0(1.0f)
19
, A1(0.0f)
20
, A2(0.0f)
21
, B1(0.0f)
22
, B2(0.0f)
23
{
24
Reset
();
25
}
26
27
inline
float
ProcessAudio(
const
float
InSample
)
28
{
29
// Use the biquad difference eq: y(n) = a0*x(n) + a1*x(n-1) + a2*x(n-2) - b1*y(n-1) - b2*y(n-2)
30
const
float
Output
= A0 *
InSample
+ A1 * X_Z1 + A2 * X_Z2 - B1 * Y_Z1 - B2 * Y_Z2;
31
32
// Apply the z-transforms
33
Y_Z2 = Y_Z1;
34
Y_Z1 =
Output
;
35
36
X_Z2 = X_Z1;
37
X_Z1 =
InSample
;
38
39
return
Output
;
40
}
41
42
// Reset the filter (flush delays)
43
void
Reset
()
44
{
45
X_Z1 = 0.0f;
46
X_Z2 = 0.0f;
47
Y_Z1 = 0.0f;
48
Y_Z2 = 0.0f;
49
}
50
51
public
:
52
// Biquad filter coefficients
53
float
A0;
54
float
A1;
55
float
A2;
56
float
B1;
57
float
B2;
58
59
protected
:
60
float
X_Z1;
// previous inputs z-transforms
61
float
X_Z2;
62
float
Y_Z1;
// prvious outputs z-transforms
63
float
Y_Z2;
64
};
65
}
CoreMinimal.h
UE_DEPRECATED
#define UE_DEPRECATED(Version, Message)
Definition
CoreMiscDefines.h:302
StaticCastSharedRef
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition
SharedPointer.h:127
Dsp.h
EPathFollowingVelocityMode::Reset
@ Reset
EUserSceneTextureEvent::Output
@ Output
Audio
NO_LOGGING.
Definition
AudioMixerPlatformAndroid.cpp:53
Engine
Source
Runtime
SignalProcessing
Public
DSP
BiQuadFilter.h
Generated by
1.9.8