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