UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ParamInterpolator.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
7namespace Audio
8{
9 class FParam
10 {
11 public:
13 : CurrentValue(0.0f)
14 , StartingValue(0.0f)
15 , TargetValue(0.0f)
16 , DeltaValue(0.0f)
17 , bIsInit(true)
18 {}
19
20 // Set the parameter value to the given target value over the given interpolation frames.
21 inline void SetValue(const float InValue, const int32 InNumInterpFrames = 0)
22 {
23 TargetValue = InValue;
24 if (bIsInit || InNumInterpFrames == 0)
25 {
26 bIsInit = false;
27 StartingValue = TargetValue;
28 CurrentValue = TargetValue;
29 DeltaValue = 0.0f;
30 }
31 else
32 {
33 DeltaValue = (InValue - CurrentValue) / (float)InNumInterpFrames;
34 StartingValue = CurrentValue;
35 }
36 }
37
38 inline void Init()
39 {
40 bIsInit = true;
41 }
42
43 // Resets the delta value back to 0.0. To be called at beginning of callback render.
44 inline void Reset()
45 {
46 DeltaValue = 0.0f;
47 CurrentValue = TargetValue;
48 }
49
50 // Updates the parameter, assumes called in one of the frames.
51 inline float Update()
52 {
53 CurrentValue += DeltaValue;
54 return CurrentValue;
55 }
56
57 // Returns the current value, but does not update the value
58 inline float GetValue() const
59 {
60 return CurrentValue;
61 }
62
63 // Returns the target value
64 inline float GetTarget() const
65 {
66 return TargetValue;
67 }
68
69 private:
70 float CurrentValue;
71 float StartingValue;
72 float TargetValue;
73 float DeltaValue;
74 bool bIsInit;
75 };
76
77}
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
return true
Definition ExternalRpcRegistry.cpp:601
Definition ParamInterpolator.h:10
void Reset()
Definition ParamInterpolator.h:44
void Init()
Definition ParamInterpolator.h:38
void SetValue(const float InValue, const int32 InNumInterpFrames=0)
Definition ParamInterpolator.h:21
float GetTarget() const
Definition ParamInterpolator.h:64
FParam()
Definition ParamInterpolator.h:12
float GetValue() const
Definition ParamInterpolator.h:58
float Update()
Definition ParamInterpolator.h:51
NO_LOGGING.
Definition AudioMixerPlatformAndroid.cpp:53