You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#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]
86 lines
1.8 KiB
C++
86 lines
1.8 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "DSP/Osc.h"
|
|
#include "DSP/ModulationMatrix.h"
|
|
|
|
namespace Audio
|
|
{
|
|
namespace ELFO
|
|
{
|
|
enum Type
|
|
{
|
|
Sine = 0,
|
|
UpSaw,
|
|
DownSaw,
|
|
Square,
|
|
Triangle,
|
|
Exponential,
|
|
RandomSampleHold,
|
|
|
|
NumLFOTypes
|
|
};
|
|
}
|
|
|
|
namespace ELFOMode
|
|
{
|
|
enum Type
|
|
{
|
|
// Constantly oscillates
|
|
Sync = 0,
|
|
|
|
// Performs the LFO only once, then stops
|
|
OneShot,
|
|
|
|
// Doesn't restart the phase of the LFO on subsequent calls to Start
|
|
Free,
|
|
|
|
NumLFOModes
|
|
};
|
|
}
|
|
|
|
// Low frequency oscillator
|
|
class SIGNALPROCESSING_API FLFO : public IOscBase
|
|
{
|
|
public:
|
|
FLFO();
|
|
virtual ~FLFO();
|
|
|
|
//~ Begin FOscBase
|
|
virtual void Init(const float InSampleRate, const int32 InVoiceId = 0, FModulationMatrix* InMatrix = nullptr, const int32 ModMatrixStage = 0) override;
|
|
virtual void Start() override;
|
|
virtual void Stop() override;
|
|
virtual void Reset() override;
|
|
virtual float Generate(float* QuadPhaseOutput = nullptr) override;
|
|
//~ End FOscBase
|
|
|
|
void SetType(const ELFO::Type InLFOType) { LFOType = InLFOType; }
|
|
ELFO::Type GetType() const { return LFOType; }
|
|
void SetMode(const ELFOMode::Type InLFOMode) { LFOMode = InLFOMode; }
|
|
ELFOMode::Type GetMode() const { return LFOMode; }
|
|
void SetExponentialFactor(const float InExpFactor) { ExponentialFactor = FMath::Min(InExpFactor, 1.0f); }
|
|
FPatchSource GetModSourceNormalPhase() const { return ModNormalPhase; }
|
|
FPatchSource GetModSourceQuadPhase() const { return ModQuadPhase; }
|
|
|
|
protected:
|
|
|
|
float ComputeLFO(const float InputPhase, float* OutQuad = nullptr);
|
|
|
|
ELFO::Type LFOType;
|
|
ELFOMode::Type LFOMode;
|
|
float ExponentialFactor;
|
|
uint32 RSHCounter;
|
|
float RSHValue;
|
|
float ModScale;
|
|
float ModAdd;
|
|
float LastOutput;
|
|
float QuadLastOutput;
|
|
|
|
FPatchSource ModNormalPhase;
|
|
FPatchSource ModQuadPhase;
|
|
};
|
|
|
|
}
|