Avoid a stateful unique_ptr deleter
[openal-soft.git] / core / front_stablizer.h
blob3d328a8d55eddfe6796f86d2fb7d957148c6f98f
1 #ifndef CORE_FRONT_STABLIZER_H
2 #define CORE_FRONT_STABLIZER_H
4 #include <array>
5 #include <memory>
7 #include "almalloc.h"
8 #include "bufferline.h"
9 #include "filters/splitter.h"
12 struct FrontStablizer {
13 static constexpr size_t DelayLength{256u};
15 FrontStablizer(size_t numchans) : DelayBuf{numchans} { }
17 alignas(16) std::array<float,BufferLineSize + DelayLength> Side{};
18 alignas(16) std::array<float,BufferLineSize + DelayLength> MidDirect{};
19 alignas(16) std::array<float,DelayLength> MidDelay{};
21 alignas(16) std::array<float,BufferLineSize + DelayLength> TempBuf{};
23 BandSplitter MidFilter;
24 alignas(16) FloatBufferLine MidLF{};
25 alignas(16) FloatBufferLine MidHF{};
27 using DelayLine = std::array<float,DelayLength>;
28 al::FlexArray<DelayLine,16> DelayBuf;
30 static std::unique_ptr<FrontStablizer> Create(size_t numchans)
31 { return std::unique_ptr<FrontStablizer>{new(FamCount(numchans)) FrontStablizer{numchans}}; }
33 DEF_FAM_NEWDEL(FrontStablizer, DelayBuf)
36 #endif /* CORE_FRONT_STABLIZER_H */