10 #include "aloptional.h"
14 #include "bufferline.h"
15 #include "mixer/hrtfdefs.h"
16 #include "intrusive_ptr.h"
23 uint mSampleRate
: 24;
30 /* NOTE: Fields are stored *backwards*. field[0] is the farthest field, and
31 * field[fdCount-1] is the nearest.
33 al::span
<const Field
> mFields
;
40 const HrirArray
*mCoeffs
;
41 const ubyte2
*mDelays
;
43 void getCoeffs(float elevation
, float azimuth
, float distance
, float spread
, HrirArray
&coeffs
,
44 const al::span
<uint
,2> delays
);
51 using HrtfStorePtr
= al::intrusive_ptr
<HrtfStore
>;
54 struct EvRadians
{ float value
; };
55 struct AzRadians
{ float value
; };
62 struct DirectHrtfState
{
63 std::array
<float,BufferLineSize
> mTemp
;
65 /* HRTF filter state for dry buffer content */
67 al::FlexArray
<HrtfChannelState
> mChannels
;
69 DirectHrtfState(size_t numchans
) : mChannels
{numchans
} { }
71 * Produces HRTF filter coefficients for decoding B-Format, given a set of
72 * virtual speaker positions, a matching decoding matrix, and per-order
73 * high-frequency gains for the decoder. The calculated impulse responses
74 * are ordered and scaled according to the matrix input.
76 void build(const HrtfStore
*Hrtf
, const uint irSize
, const bool perHrirMin
,
77 const al::span
<const AngularPoint
> AmbiPoints
, const float (*AmbiMatrix
)[MaxAmbiChannels
],
78 const float XOverFreq
, const al::span
<const float,MaxAmbiOrder
+1> AmbiOrderHFGain
);
80 static std::unique_ptr
<DirectHrtfState
> Create(size_t num_chans
);
82 DEF_FAM_NEWDEL(DirectHrtfState
, mChannels
)
86 al::vector
<std::string
> EnumerateHrtf(al::optional
<std::string
> pathopt
);
87 HrtfStorePtr
GetLoadedHrtf(const std::string
&name
, const uint devrate
);
89 #endif /* CORE_HRTF_H */