diff options
author | Chris Robinson <[email protected]> | 2020-12-25 20:52:18 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-12-25 20:52:18 -0800 |
commit | 5f233a2c24de58fde98e08ad8acb6cfe1803d716 (patch) | |
tree | a62086d205cfa4d66719dd2d4b42eac7563ded39 /core/mixer/hrtfdefs.h | |
parent | 223f93e13d2a36375fa71251a2e565799cc2ab3e (diff) |
Use more constexpr variables instead of macros
Diffstat (limited to 'core/mixer/hrtfdefs.h')
-rw-r--r-- | core/mixer/hrtfdefs.h | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/core/mixer/hrtfdefs.h b/core/mixer/hrtfdefs.h index 552fc152..89a9bb8d 100644 --- a/core/mixer/hrtfdefs.h +++ b/core/mixer/hrtfdefs.h @@ -8,42 +8,43 @@ #include "core/filters/splitter.h" -#define HRTF_HISTORY_BITS 6 -#define HRTF_HISTORY_LENGTH (1<<HRTF_HISTORY_BITS) -#define HRTF_HISTORY_MASK (HRTF_HISTORY_LENGTH-1) - -#define HRIR_BITS 7 -#define HRIR_LENGTH (1<<HRIR_BITS) -#define HRIR_MASK (HRIR_LENGTH-1) - -#define MIN_IR_LENGTH 8 - -#define HRTF_DIRECT_DELAY 256 - using float2 = std::array<float,2>; -using HrirArray = std::array<float2,HRIR_LENGTH>; using ubyte = unsigned char; using ubyte2 = std::array<ubyte,2>; using ushort = unsigned short; using uint = unsigned int; +using uint2 = std::array<uint,2>; + +constexpr uint HrtfHistoryBits{6}; +constexpr uint HrtfHistoryLength{1 << HrtfHistoryBits}; +constexpr uint HrtfHistoryMask{HrtfHistoryLength - 1}; + +constexpr uint HrirBits{7}; +constexpr uint HrirLength{1 << HrirBits}; +constexpr uint HrirMask{HrirLength - 1}; + +constexpr uint MinIrLength{8}; + +constexpr uint HrtfDirectDelay{256}; +using HrirArray = std::array<float2,HrirLength>; struct MixHrtfFilter { const HrirArray *Coeffs; - std::array<uint,2> Delay; + uint2 Delay; float Gain; float GainStep; }; struct HrtfFilter { alignas(16) HrirArray Coeffs; - std::array<uint,2> Delay; + uint2 Delay; float Gain; }; struct HrtfChannelState { - std::array<float,HRTF_DIRECT_DELAY> mDelay{}; + std::array<float,HrtfDirectDelay> mDelay{}; BandSplitter mSplitter; float mHfScale{}; alignas(16) HrirArray mCoeffs{}; |