Make some structs nested
[openal-soft.git] / core / mixer / hrtfdefs.h
blob7046a31e3bd876b1e9658ec8912038b26b2d1d8a
1 #ifndef CORE_MIXER_HRTFDEFS_H
2 #define CORE_MIXER_HRTFDEFS_H
4 #include <array>
6 #include "alspan.h"
7 #include "core/ambidefs.h"
8 #include "core/bufferline.h"
9 #include "core/filters/splitter.h"
12 using float2 = std::array<float,2>;
13 using ubyte = unsigned char;
14 using ubyte2 = std::array<ubyte,2>;
15 using ushort = unsigned short;
16 using uint = unsigned int;
17 using uint2 = std::array<uint,2>;
19 constexpr uint HrtfHistoryBits{6};
20 constexpr uint HrtfHistoryLength{1 << HrtfHistoryBits};
21 constexpr uint HrtfHistoryMask{HrtfHistoryLength - 1};
23 constexpr uint HrirBits{7};
24 constexpr uint HrirLength{1 << HrirBits};
25 constexpr uint HrirMask{HrirLength - 1};
27 constexpr uint MinIrLength{8};
29 constexpr uint HrtfDirectDelay{256};
31 using HrirArray = std::array<float2,HrirLength>;
32 using HrirSpan = al::span<float2,HrirLength>;
33 using ConstHrirSpan = al::span<const float2,HrirLength>;
35 struct MixHrtfFilter {
36 const ConstHrirSpan Coeffs;
37 uint2 Delay;
38 float Gain;
39 float GainStep;
42 struct HrtfFilter {
43 alignas(16) HrirArray Coeffs;
44 uint2 Delay;
45 float Gain;
49 struct HrtfChannelState {
50 std::array<float,HrtfDirectDelay> mDelay{};
51 BandSplitter mSplitter;
52 float mHfScale{};
53 alignas(16) HrirArray mCoeffs{};
56 #endif /* CORE_MIXER_HRTFDEFS_H */