You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- 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]
40 lines
741 B
C++
40 lines
741 B
C++
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "DSP/WaveShaper.h"
|
|
#include "DSP/Dsp.h"
|
|
|
|
namespace Audio
|
|
{
|
|
FWaveShaper::FWaveShaper()
|
|
: Amount(1.0f)
|
|
, AtanAmount(FMath::Atan(Amount))
|
|
, OutputGain(1.0f)
|
|
{
|
|
}
|
|
|
|
FWaveShaper::~FWaveShaper()
|
|
{
|
|
}
|
|
|
|
void FWaveShaper::Init(const float InSampleRate)
|
|
{
|
|
}
|
|
|
|
void FWaveShaper::SetAmount(const float InAmount)
|
|
{
|
|
Amount = FMath::Max(InAmount, SMALL_NUMBER);
|
|
AtanAmount = FMath::Atan(Amount);
|
|
}
|
|
|
|
void FWaveShaper::SetOutputGainDb(const float InGainDb)
|
|
{
|
|
OutputGain = Audio::ConvertToLinear(InGainDb);
|
|
}
|
|
|
|
void FWaveShaper::ProcessAudio(const float InSample, float& OutSample)
|
|
{
|
|
OutSample = OutputGain * FMath::Atan(InSample * Amount) / AtanAmount;
|
|
}
|
|
|
|
}
|