]> git.tdb.fi Git - ext/openal.git/blob - core/mixer/hrtfdefs.h
Import OpenAL Soft 1.23.1 sources
[ext/openal.git] / core / mixer / hrtfdefs.h
1 #ifndef CORE_MIXER_HRTFDEFS_H
2 #define CORE_MIXER_HRTFDEFS_H
3
4 #include <array>
5
6 #include "alspan.h"
7 #include "core/ambidefs.h"
8 #include "core/bufferline.h"
9 #include "core/filters/splitter.h"
10
11
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>;
18
19 constexpr uint HrtfHistoryBits{6};
20 constexpr uint HrtfHistoryLength{1 << HrtfHistoryBits};
21 constexpr uint HrtfHistoryMask{HrtfHistoryLength - 1};
22
23 constexpr uint HrirBits{7};
24 constexpr uint HrirLength{1 << HrirBits};
25 constexpr uint HrirMask{HrirLength - 1};
26
27 constexpr uint MinIrLength{8};
28
29 using HrirArray = std::array<float2,HrirLength>;
30 using HrirSpan = al::span<float2,HrirLength>;
31 using ConstHrirSpan = al::span<const float2,HrirLength>;
32
33 struct MixHrtfFilter {
34     const ConstHrirSpan Coeffs;
35     uint2 Delay;
36     float Gain;
37     float GainStep;
38 };
39
40 struct HrtfFilter {
41     alignas(16) HrirArray Coeffs;
42     uint2 Delay;
43     float Gain;
44 };
45
46
47 struct HrtfChannelState {
48     BandSplitter mSplitter;
49     float mHfScale{};
50     alignas(16) HrirArray mCoeffs{};
51 };
52
53 #endif /* CORE_MIXER_HRTFDEFS_H */