diff options
author | Chris Robinson <[email protected]> | 2020-12-12 14:58:09 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-12-12 14:58:09 -0800 |
commit | e179bf0a12e80eb41041469bc04ba1fbcffe11e8 (patch) | |
tree | 0e42d2b17f1005fad29ec4f509b1530a15213b88 /core/mixer/hrtfdefs.h | |
parent | 14df53411402bae0e5dcdea8bc0d2d3ba30e7923 (diff) |
Move the mixer functions to core
Diffstat (limited to 'core/mixer/hrtfdefs.h')
-rw-r--r-- | core/mixer/hrtfdefs.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/core/mixer/hrtfdefs.h b/core/mixer/hrtfdefs.h new file mode 100644 index 00000000..623e6ec3 --- /dev/null +++ b/core/mixer/hrtfdefs.h @@ -0,0 +1,52 @@ +#ifndef CORE_MIXER_HRTFDEFS_H +#define CORE_MIXER_HRTFDEFS_H + +#include <array> + +#include "core/ambidefs.h" +#include "core/bufferline.h" +#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 192 + +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; + + +struct MixHrtfFilter { + const HrirArray *Coeffs; + std::array<uint,2> Delay; + float Gain; + float GainStep; +}; + +struct HrtfFilter { + alignas(16) HrirArray Coeffs; + std::array<uint,2> Delay; + float Gain; +}; + + +struct HrtfChannelState { + std::array<float,HRTF_DIRECT_DELAY> mDelay{}; + BandSplitter mSplitter; + float mHfScale{}; + alignas(16) HrirArray mCoeffs{}; +}; + +#endif /* CORE_MIXER_HRTFDEFS_H */ |