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]
53 lines
1.1 KiB
C++
53 lines
1.1 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "DSP/Osc.h"
|
|
|
|
namespace Audio
|
|
{
|
|
// Bit crushing effect
|
|
// https://en.wikipedia.org/wiki/Bitcrusher
|
|
class SIGNALPROCESSING_API FBitCrusher
|
|
{
|
|
public:
|
|
// Constructor
|
|
FBitCrusher();
|
|
|
|
// Destructor
|
|
~FBitCrusher();
|
|
|
|
// Initialize the equalizer
|
|
void Init(const float InSampleRate, const int32 InNumChannels);
|
|
|
|
// The amount to reduce the sample rate of the audio stream.
|
|
void SetSampleRateCrush(const float InFrequency);
|
|
|
|
// The amount to reduce the bit depth of the audio stream.
|
|
void SetBitDepthCrush(const float InBitDepth);
|
|
|
|
// Processes audio
|
|
void ProcessAudioFrame(const float* InFrame, float* OutFrame);
|
|
void ProcessAudio(const float* InBuffer, const int32 InNumSamples, float* OutBuffer);
|
|
|
|
private:
|
|
// i.e. 8 bit, etc. But can be float!
|
|
float SampleRate;
|
|
float BitDepth;
|
|
float BitDelta;
|
|
|
|
// The current phase of the bit crusher
|
|
float Phase;
|
|
|
|
// The amount of phase to increment each sample
|
|
float PhaseDelta;
|
|
|
|
// Used to sample+hold the last output
|
|
float LastOutput[2];
|
|
|
|
int32 NumChannels;
|
|
};
|
|
|
|
}
|