UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Amp.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/Osc.h"
7
8namespace Audio
9{
10 struct FWetDry
11 {
12 // Level of wet signal
13 float WetLevel;
14
15 // Level of dry signal
16 float DryLevel;
17
18 FWetDry(float InWetLevel = 1.0f, float InDryLevel = 0.0f)
19 : WetLevel(InWetLevel)
20 , DryLevel(InDryLevel)
21 {
22 }
23 };
24
25 // Class which manages scaling audio input and performing panning operations
26 class FAmp
27 {
28 public:
31
32 // Initializes the amp with the mod matrix
34
35 // Sets the direct gain in decibel
36 SIGNALPROCESSING_API void SetGainDb(const float InGainDB);
37
38 // Sets the gain modulation in decibel
40
41 // Sets the direct gain in linear
43
44 // Sets the gain modulation in linear. Expects modulation value to be bipolar (for AM synth, etc)
46
47 // Sets the gain based on an envelope value
49
50 // Sets the gain based on an envelope value
52
53 // Change the allowed range of the gain output
54 SIGNALPROCESSING_API void SetGainRange(const float InMin, const float InMax);
55
56 // Sets the gain using a midi velocity value
58
59 // Sets the pan
60 SIGNALPROCESSING_API void SetPan(const float InPan);
61
62 // Sets the pan modulator
64
65 // Takes mono input and generates stereo output
66 SIGNALPROCESSING_API void ProcessAudio(const float LeftIn, float* LeftOutput, float* RightOutput);
67
68 // Takes stereo input and generates stereo output
69 SIGNALPROCESSING_API void ProcessAudio(const float LeftIn, const float RightIn, float* LeftOutput, float* RightOutput);
70
71 // Generates a new gain value for left and right outputs.
73
75
76 // Updates the final output left and right gain based on current settings
78
82
83 protected:
85
86 // The final left and right output gain values
87 float LeftGain;
88 float RightGain;
89
90 // Values used for lerping gain values to avoid zippering
93
96
99
100
101 // Min and max output gain, can be changed based on need
102 float GainMin;
103 float GainMax;
104
105 // Direct input gain control (i.e. gain slider)
107
108 // Gain due to midi velocity
110
111 // A modulated value of gain, can be used for tremolo or amplitude modulation
112 float GainMod;
113
114 // Gain set from envelope
115 float GainEnv;
116
117 // Linear pan value [-1.0, 1.0]
118 float Pan;
119
120 // Linear pan modulator
121 float PanMod;
122
123 // Mod matrix
128
129 // Whether or not something changed since the last time generate was called
131
132 };
133}
@ 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
Definition Amp.h:27
float GainEnv
Definition Amp.h:115
FPatchDestination GainScaleDest
Definition Amp.h:125
float TargetLeftSlope
Definition Amp.h:97
SIGNALPROCESSING_API void SetGainModDb(const float InGainModDb)
Definition Amp.cpp:66
int32 TargetDeltaSamples
Definition Amp.h:94
SIGNALPROCESSING_API void SetPan(const float InPan)
Definition Amp.cpp:109
float LeftGain
Definition Amp.h:87
SIGNALPROCESSING_API void SetGainEnv(const float InGainEnv)
Definition Amp.cpp:85
const FPatchDestination GetModDestPan() const
Definition Amp.h:81
SIGNALPROCESSING_API void Reset()
Definition Amp.cpp:195
SIGNALPROCESSING_API ~FAmp()
Definition Amp.cpp:31
float RightGain
Definition Amp.h:88
SIGNALPROCESSING_API void SetGainDb(const float InGainDB)
Definition Amp.cpp:60
int32 VoiceId
Definition Amp.h:84
SIGNALPROCESSING_API void SetPanModulator(const float InPanMod)
Definition Amp.cpp:115
FModulationMatrix * ModMatrix
Definition Amp.h:124
SIGNALPROCESSING_API void Generate(float &OutGainLeft, float &OutGainRight)
Definition Amp.cpp:156
FPatchDestination GainPanDest
Definition Amp.h:127
float GainVelocity
Definition Amp.h:109
float GainMin
Definition Amp.h:102
const FPatchDestination GetModDestGainScale() const
Definition Amp.h:79
float Pan
Definition Amp.h:118
SIGNALPROCESSING_API void SetGain(const float InGainLinear)
Definition Amp.cpp:73
const FPatchDestination GetModDestGainEnv() const
Definition Amp.h:80
SIGNALPROCESSING_API void Update()
Definition Amp.cpp:121
bool bChanged
Definition Amp.h:130
float GainMod
Definition Amp.h:112
SIGNALPROCESSING_API FAmp()
Definition Amp.cpp:8
float PanMod
Definition Amp.h:121
float TargetRightSlope
Definition Amp.h:98
SIGNALPROCESSING_API void SetGainEnvDb(const float InGainEnvDb)
Definition Amp.cpp:91
int32 CurrentLerpSample
Definition Amp.h:95
float GainControl
Definition Amp.h:106
SIGNALPROCESSING_API void SetGainMod(const float InBipolarGainModLinear)
Definition Amp.cpp:79
SIGNALPROCESSING_API void ProcessAudio(const float LeftIn, float *LeftOutput, float *RightOutput)
Definition Amp.cpp:169
float GainMax
Definition Amp.h:103
float TargetRightGain
Definition Amp.h:92
FPatchDestination GainEnvDest
Definition Amp.h:126
float TargetLeftGain
Definition Amp.h:91
SIGNALPROCESSING_API void SetGainRange(const float InMin, const float InMax)
Definition Amp.cpp:96
Definition ModulationMatrix.h:102
NO_LOGGING.
Definition AudioMixerPlatformAndroid.cpp:53
Definition ModulationMatrix.h:37
Definition Amp.h:11
float WetLevel
Definition Amp.h:13
FWetDry(float InWetLevel=1.0f, float InDryLevel=0.0f)
Definition Amp.h:18
float DryLevel
Definition Amp.h:16