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]
63 lines
1.4 KiB
C++
63 lines
1.4 KiB
C++
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "DSP/Osc.h"
|
|
|
|
namespace Audio
|
|
{
|
|
// Foldback distortion effect
|
|
// https://en.wikipedia.org/wiki/Foldback_(power_supply_design)
|
|
class SIGNALPROCESSING_API FFoldbackDistortion
|
|
{
|
|
public:
|
|
// Constructor
|
|
FFoldbackDistortion();
|
|
|
|
// Destructor
|
|
~FFoldbackDistortion();
|
|
|
|
// Initialize the equalizer
|
|
void Init(const float InSampleRate, const int32 InNumChannels);
|
|
|
|
// Sets the foldback distortion threshold
|
|
void SetThresholdDb(const float InThresholdDb);
|
|
|
|
// Sets the input gain
|
|
void SetInputGainDb(const float InInputGainDb);
|
|
|
|
// Sets the output gain
|
|
void SetOutputGainDb(const float InOutputGainDb);
|
|
|
|
// Processes a single audio sample
|
|
float ProcessAudioSample(const float InSample);
|
|
|
|
// Processes a mono stream
|
|
void ProcessAudioFrame(const float* InFrame, float* OutFrame);
|
|
|
|
// Processes a stereo stream
|
|
void ProcessAudio(const float* InBuffer, const int32 InNumSamples, float* OutBuffer);
|
|
|
|
private:
|
|
// Threshold to check before folding audio back on itself
|
|
float Threshold;
|
|
|
|
// Threshold times 2
|
|
float Threshold2;
|
|
|
|
// Threshold time 4
|
|
float Threshold4;
|
|
|
|
// Input gain used to force hitting the threshold
|
|
float InputGain;
|
|
|
|
// A final gain scaler to apply to the output
|
|
float OutputGain;
|
|
|
|
// How many channels we expect the audio intput to be.
|
|
int32 NumChannels;
|
|
};
|
|
|
|
}
|