You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
d79515867d
- Up to CL8320930 from DevOnline and 8311605 Merge Down from Main - skipped some Fortnite content/plugins/code where it tried to reintegrate files that had been moved pending investigation #rb none [CL 8321295 by Josh Markiewicz in Main branch]
72 lines
1.4 KiB
C++
72 lines
1.4 KiB
C++
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
namespace Audio
|
|
{
|
|
class FParam
|
|
{
|
|
public:
|
|
FParam()
|
|
: CurrentValue(0.0f)
|
|
, StartingValue(0.0f)
|
|
, TargetValue(0.0f)
|
|
, DeltaValue(0.0f)
|
|
, bIsInit(true)
|
|
{}
|
|
|
|
// Set the parameter value to the given target value over the given interpolation frames.
|
|
FORCEINLINE void SetValue(const float InValue, const int32 InNumInterpFrames = 0)
|
|
{
|
|
TargetValue = InValue;
|
|
if (bIsInit || InNumInterpFrames == 0)
|
|
{
|
|
bIsInit = false;
|
|
StartingValue = TargetValue;
|
|
CurrentValue = TargetValue;
|
|
DeltaValue = 0.0f;
|
|
}
|
|
else
|
|
{
|
|
DeltaValue = (InValue - CurrentValue) / InNumInterpFrames;
|
|
StartingValue = CurrentValue;
|
|
}
|
|
}
|
|
|
|
FORCEINLINE void Init()
|
|
{
|
|
bIsInit = true;
|
|
}
|
|
|
|
// Resets the delta value back to 0.0. To be called at beginning of callback render.
|
|
FORCEINLINE void Reset()
|
|
{
|
|
DeltaValue = 0.0f;
|
|
CurrentValue = TargetValue;
|
|
}
|
|
|
|
// Updates the parameter, assumes called in one of the frames.
|
|
FORCEINLINE float Update()
|
|
{
|
|
CurrentValue += DeltaValue;
|
|
return CurrentValue;
|
|
}
|
|
|
|
// Returns the current value, but does not update the value
|
|
FORCEINLINE float GetValue() const
|
|
{
|
|
return CurrentValue;
|
|
}
|
|
|
|
private:
|
|
float CurrentValue;
|
|
float StartingValue;
|
|
float TargetValue;
|
|
float DeltaValue;
|
|
bool bIsInit;
|
|
};
|
|
|
|
}
|