Files
UnrealEngineUWP/Engine/Source/Runtime/SignalProcessing/Public/DSP/Phaser.h
ryan durand 0f0464a30e Updating copyright for Engine Runtime.
#rnx
#rb none


#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900
#ROBOMERGE-BOT: (v613-10869866)

[CL 10870549 by ryan durand in Main branch]
2019-12-26 14:45:42 -05:00

72 lines
1.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "DSP/Delay.h"
#include "DSP/LFO.h"
#include "DSP/Filter.h"
namespace Audio
{
class SIGNALPROCESSING_API FPhaser
{
public:
FPhaser();
~FPhaser();
void Init(const float SampleRate, const int32 InNumChannels);
// Sets the phaser LFO rate
void SetFrequency(const float InFreqHz);
// Sets the wet level of the phaser
void SetWetLevel(const float InWetLevel);
// Sets the feedback of the phaser
void SetFeedback(const float InFeedback);
// Sets the phaser LFO type
void SetLFOType(const ELFO::Type LFOType);
// Sets whether or not to put the phaser in quadrature mode
void SetQuadPhase(const bool bQuadPhase);
// Process an audio frame
void ProcessAudioFrame(const float* InFrame, float* OutFrame);
// Process an audio buffer.
void ProcessAudio(const float* InBuffer, const int32 InNumSamples, float* OutBuffer);
protected:
void ComputeNewCoefficients(const int32 ChannelIndex, const float LFOValue);
// First-order all-pass filters in series
static const int32 NumApfs = 6;
static const int32 MaxNumChannels = 2;
int32 ControlSampleCount;
int32 ControlRate;
float Frequency;
float WetLevel;
float Feedback;
ELFO::Type LFOType;
// 6 APFs per channel
FBiquadFilter APFs[MaxNumChannels][NumApfs];
FVector2D APFFrequencyRanges[NumApfs];
// Feedback samples
float FeedbackFrame[MaxNumChannels];
FLFO LFO;
// Number of channels actually used
int32 NumChannels;
bool bIsBiquadPhase;
};
}