🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.2 KiB

  1. #ifndef CORE_MIXER_HRTFDEFS_H
  2. #define CORE_MIXER_HRTFDEFS_H
  3. #include <array>
  4. #include "alspan.h"
  5. #include "core/ambidefs.h"
  6. #include "core/bufferline.h"
  7. #include "core/filters/splitter.h"
  8. using float2 = std::array<float,2>;
  9. using ubyte = unsigned char;
  10. using ubyte2 = std::array<ubyte,2>;
  11. using ushort = unsigned short;
  12. using uint = unsigned int;
  13. using uint2 = std::array<uint,2>;
  14. constexpr uint HrtfHistoryBits{6};
  15. constexpr uint HrtfHistoryLength{1 << HrtfHistoryBits};
  16. constexpr uint HrtfHistoryMask{HrtfHistoryLength - 1};
  17. constexpr uint HrirBits{7};
  18. constexpr uint HrirLength{1 << HrirBits};
  19. constexpr uint HrirMask{HrirLength - 1};
  20. constexpr uint MinIrLength{8};
  21. using HrirArray = std::array<float2,HrirLength>;
  22. using HrirSpan = al::span<float2,HrirLength>;
  23. using ConstHrirSpan = al::span<const float2,HrirLength>;
  24. struct MixHrtfFilter {
  25. const ConstHrirSpan Coeffs;
  26. uint2 Delay;
  27. float Gain;
  28. float GainStep;
  29. };
  30. struct HrtfFilter {
  31. alignas(16) HrirArray Coeffs;
  32. uint2 Delay;
  33. float Gain;
  34. };
  35. struct HrtfChannelState {
  36. BandSplitter mSplitter;
  37. float mHfScale{};
  38. alignas(16) HrirArray mCoeffs{};
  39. };
  40. #endif /* CORE_MIXER_HRTFDEFS_H */