UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AlignedBlockBuffer.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4#include "CoreMinimal.h"
6
7namespace Audio
8{
9 // First In First Out Buffer designed for audio buffers. Generally performs best when buffers are greater
10 // than 16 samples, optimally for buffers between 256 to 4096 samples. Memory operations are designed
11 // for audio applications by ensuring memory allocations only occur in the constructor or when capacity
12 // is altered, memory freeing only happens in the destructor or when capacity is altered. All assignments
13 // are performed using block memory copies.
15 {
16 public:
17
18 // Constructor
20
21 // Destructor
23
24 // Maximum size of buffer
26
27 // Amount of samples left over in buffer
29
30 // Add zeros to the buffer
32
33 // Add samples to the buffer.
35
36 // Remove samples from the buffer
38
39 // Clear entire buffer
41
42 // Inspect samples in the buffer. Returned samples abide by the memory alignment specified during construction.
43 // Warning: Not thread safe. The returned pointer is only valid as long as this object exists
44 // and before any mutating operations are made to this object.
45 SIGNALPROCESSING_API const float* InspectSamples(int32 InNum, int32 InOffset=0);
46
47 // Maximum number of elements that can be inspected
49
50 protected:
51
52 // Set the maximum number of elements that can be inspected
54
56 SIGNALPROCESSING_API void FreeFloatArray(float*& Array) const;
58 SIGNALPROCESSING_API void CopyFloatArray(float* ToArray, const float* FromArray, int32 InNum) const;
59
60 private:
61
62 int32 CheckNumAndIncrementWriteCount(int32 InNum);
63
64 // Hide copy and assignment operators
67
68 // Alignment definition
69 uint32 AllocByteAlignment;
70 uint32 ByteAlignment;
71 uint32 FloatAlignment;
72
73 // Internal memory
74 float* InternalBuffer;
75 float* RolloverBuffer;
76
77 // Read and write pointers
78 float* ReadPointer;
79 float* WritePointer;
80
81 int32 SampleCapacity;
82 int32 MaxNumInspectSamples;
83 int32 WriteCount;
84 int32 WritePos;
85 int32 ReadPos;
86 };
87}
88
#define AUDIO_SIMD_BYTE_ALIGNMENT
Definition AlignedBuffer.h:12
#define AUDIO_BUFFER_ALIGNMENT
Definition AudioResampler.h:13
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
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition AlignedBlockBuffer.h:15
SIGNALPROCESSING_API void CopyFloatArray(float *ToArray, const float *FromArray, int32 InNum) const
Definition AlignedBlockBuffer.cpp:319
SIGNALPROCESSING_API void FreeFloatArray(float *&Array) const
Definition AlignedBlockBuffer.cpp:304
SIGNALPROCESSING_API void AddZeros(int32 InNum)
Definition AlignedBlockBuffer.cpp:105
SIGNALPROCESSING_API void SetMaxNumInspectSamples(int32 InMax)
Definition AlignedBlockBuffer.cpp:287
SIGNALPROCESSING_API ~FAlignedBlockBuffer()
Definition AlignedBlockBuffer.cpp:68
SIGNALPROCESSING_API void ZeroFloatArray(float *InArray, int32 InNum) const
Definition AlignedBlockBuffer.cpp:310
SIGNALPROCESSING_API int32 GetNumAvailable() const
Definition AlignedBlockBuffer.cpp:79
SIGNALPROCESSING_API void AddSamples(const float *InSamples, int32 InNum)
Definition AlignedBlockBuffer.cpp:136
SIGNALPROCESSING_API void RemoveSamples(int32 InNum)
Definition AlignedBlockBuffer.cpp:178
SIGNALPROCESSING_API int32 GetSampleCapacity() const
Definition AlignedBlockBuffer.cpp:74
SIGNALPROCESSING_API int32 GetMaxNumInspectSamples() const
Definition AlignedBlockBuffer.cpp:282
SIGNALPROCESSING_API float * AllocateAlignedFloatArray(int32 InNum) const
Definition AlignedBlockBuffer.cpp:298
SIGNALPROCESSING_API const float * InspectSamples(int32 InNum, int32 InOffset=0)
Definition AlignedBlockBuffer.cpp:212
SIGNALPROCESSING_API void ClearSamples()
Definition AlignedBlockBuffer.cpp:269
NO_LOGGING.
Definition AudioMixerPlatformAndroid.cpp:53