12 /* The maximum number of virtual speakers used to generate HRTF coefficients
13 * for decoding B-Format.
15 #define HRTF_AMBI_MAX_CHANNELS 18
18 #define HRTF_HISTORY_BITS (6)
19 #define HRTF_HISTORY_LENGTH (1<<HRTF_HISTORY_BITS)
20 #define HRTF_HISTORY_MASK (HRTF_HISTORY_LENGTH-1)
23 #define HRIR_LENGTH (1<<HRIR_BITS)
24 #define HRIR_MASK (HRIR_LENGTH-1)
38 const ALubyte
*azCount
;
39 const ALushort
*evOffset
;
40 const ALfloat (*coeffs
)[2];
41 const ALubyte (*delays
)[2];
45 typedef struct HrtfState
{
46 alignas(16) ALfloat History
[HRTF_HISTORY_LENGTH
];
47 alignas(16) ALfloat Values
[HRIR_LENGTH
][2];
50 typedef struct HrtfParams
{
51 alignas(16) ALfloat Coeffs
[HRIR_LENGTH
][2];
56 typedef struct DirectHrtfState
{
57 /* HRTF filter state for dry buffer content */
61 alignas(16) ALfloat Values
[HRIR_LENGTH
][2];
62 alignas(16) ALfloat Coeffs
[HRIR_LENGTH
][2];
74 vector_EnumeratedHrtf
EnumerateHrtf(const_al_string devname
);
75 void FreeHrtfList(vector_EnumeratedHrtf
*list
);
76 struct Hrtf
*GetLoadedHrtf(struct HrtfEntry
*entry
);
77 void Hrtf_IncRef(struct Hrtf
*hrtf
);
78 void Hrtf_DecRef(struct Hrtf
*hrtf
);
80 void GetHrtfCoeffs(const struct Hrtf
*Hrtf
, ALfloat elevation
, ALfloat azimuth
, ALfloat spread
, ALfloat (*coeffs
)[2], ALsizei
*delays
);
83 * Produces HRTF filter coefficients for decoding B-Format, given a set of
84 * virtual speaker positions and HF/LF matrices for decoding to them. The
85 * returned coefficients are ordered and scaled according to the matrices.
87 void BuildBFormatHrtf(const struct Hrtf
*Hrtf
, DirectHrtfState
*state
, ALsizei NumChannels
, const struct AngularPoint
*AmbiPoints
, const ALfloat (*restrict AmbiMatrix
)[MAX_AMBI_COEFFS
], ALsizei AmbiCount
, const ALfloat
*restrict AmbiOrderHFGain
);
89 #endif /* ALC_HRTF_H */