aboutsummaryrefslogtreecommitdiffstats
path: root/alc/front_stablizer.h
blob: 5e7c267fa88d8bca2c75981fd8afd73705196b1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef ALC_FRONT_STABLIZER_H
#define ALC_FRONT_STABLIZER_H

#include <array>
#include <memory>

#include "almalloc.h"
#include "bufferline.h"
#include "filters/splitter.h"


struct FrontStablizer {
    static constexpr size_t DelayLength{256u};

    FrontStablizer(size_t numchans) : DelayBuf{numchans} { }

    alignas(16) std::array<float,BUFFERSIZE + DelayLength> Side{};
    alignas(16) std::array<float,BUFFERSIZE + DelayLength> MidDirect{};
    alignas(16) std::array<float,DelayLength> MidDelay{};

    alignas(16) std::array<float,BUFFERSIZE + DelayLength> TempBuf{};

    BandSplitter MidFilter;
    alignas(16) FloatBufferLine MidLF{};
    alignas(16) FloatBufferLine MidHF{};

    using DelayLine = std::array<float,DelayLength>;
    al::FlexArray<DelayLine,16> DelayBuf;

    static std::unique_ptr<FrontStablizer> Create(size_t numchans)
    { return std::unique_ptr<FrontStablizer>{new(FamCount(numchans)) FrontStablizer{numchans}}; }

    DEF_FAM_NEWDEL(FrontStablizer, DelayBuf)
};

#endif /* ALC_FRONT_STABLIZER_H */