Band-split the HRIRs when building the ambisonic decoder filters
[openal-soft.git] / Alc / hrtf.h
blobd3ecfc3c1c1e60837812ae5eb7485927028c8dd7
1 #ifndef ALC_HRTF_H
2 #define ALC_HRTF_H
4 #include "AL/al.h"
5 #include "AL/alc.h"
7 #include "alstring.h"
10 struct Hrtf {
11 ALuint sampleRate;
12 ALuint irSize;
13 ALubyte evCount;
15 const ALubyte *azCount;
16 const ALushort *evOffset;
17 const ALshort *coeffs;
18 const ALubyte *delays;
20 const char *filename;
21 struct Hrtf *next;
24 typedef struct HrtfEntry {
25 al_string name;
27 const struct Hrtf *hrtf;
28 } HrtfEntry;
29 TYPEDEF_VECTOR(HrtfEntry, vector_HrtfEntry)
31 #define HRIR_BITS (7)
32 #define HRIR_LENGTH (1<<HRIR_BITS)
33 #define HRIR_MASK (HRIR_LENGTH-1)
34 #define HRTFDELAY_BITS (20)
35 #define HRTFDELAY_FRACONE (1<<HRTFDELAY_BITS)
36 #define HRTFDELAY_MASK (HRTFDELAY_FRACONE-1)
38 void FreeHrtfs(void);
40 vector_HrtfEntry EnumerateHrtf(const_al_string devname);
41 void FreeHrtfList(vector_HrtfEntry *list);
43 void GetLerpedHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat spread, ALfloat gain, ALfloat (*coeffs)[2], ALuint *delays);
45 /* Produces HRTF filter coefficients for decoding B-Format. The result will
46 * have ACN ordering with N3D normalization. NumChannels must currently be 4,
47 * for first-order. Returns the maximum impulse-response length of the
48 * generated coefficients.
50 ALuint BuildBFormatHrtf(const struct Hrtf *Hrtf, ALfloat (*coeffs)[HRIR_LENGTH][2], ALuint NumChannels);
52 #endif /* ALC_HRTF_H */