UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
BitCrusher.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "DSP/Osc.h"
7
8namespace Audio
9{
10 // Bit crushing effect
11 // https://en.wikipedia.org/wiki/Bitcrusher
13 {
14 public:
15 // Constructor
17
18 // Destructor
20
21 // Initialize the equalizer
23
24 // The amount to reduce the sample rate of the audio stream.
26
27 // The amount to reduce the bit depth of the audio stream.
29
30 // Processes audio
31 SIGNALPROCESSING_API void ProcessAudioFrame(const float* InFrame, float* OutFrame);
32 SIGNALPROCESSING_API void ProcessAudio(const float* InBuffer, const int32 InNumSamples, float* OutBuffer);
33
34 // Returns the maximum value given bit depths will be clamped to.
36
37 private:
38 // i.e. 8 bit, etc. But can be float!
39 float SampleRate;
40 float BitDepth;
41 float BitDelta;
42 float ReciprocalBitDelta;
43
44 // The current phase of the bit crusher
45 float Phase;
46
47 // The amount of phase to increment each sample
48 float PhaseDelta;
49
50 // Used to sample+hold the last output
51 float LastOutput[2];
52
53 int32 NumChannels;
54 };
55
56}
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
void Init()
Definition LockFreeList.h:4
Definition BitCrusher.h:13
SIGNALPROCESSING_API void SetSampleRateCrush(const float InFrequency)
Definition BitCrusher.cpp:32
SIGNALPROCESSING_API void SetBitDepthCrush(const float InBitDepth)
Definition BitCrusher.cpp:37
SIGNALPROCESSING_API ~FBitCrusher()
Definition BitCrusher.cpp:21
SIGNALPROCESSING_API void ProcessAudio(const float *InBuffer, const int32 InNumSamples, float *OutBuffer)
Definition BitCrusher.cpp:63
static SIGNALPROCESSING_API float GetMaxBitDepth()
Definition BitCrusher.cpp:71
SIGNALPROCESSING_API void ProcessAudioFrame(const float *InFrame, float *OutFrame)
Definition BitCrusher.cpp:44
SIGNALPROCESSING_API FBitCrusher()
Definition BitCrusher.cpp:9
NO_LOGGING.
Definition AudioMixerPlatformAndroid.cpp:53