Implement opening and closing devices in the router
[openal-soft.git] / Alc / hrtf.h
blob186ba3b241d6f7065424991dad73801e5730c126
1 #ifndef ALC_HRTF_H
2 #define ALC_HRTF_H
4 #include "AL/al.h"
5 #include "AL/alc.h"
7 #include "alMain.h"
8 #include "alstring.h"
9 #include "atomic.h"
12 #define HRTFDELAY_BITS (20)
13 #define HRTFDELAY_FRACONE (1<<HRTFDELAY_BITS)
14 #define HRTFDELAY_MASK (HRTFDELAY_FRACONE-1)
16 /* The maximum number of virtual speakers used to generate HRTF coefficients
17 * for decoding B-Format.
19 #define HRTF_AMBI_MAX_CHANNELS 16
22 struct HrtfEntry;
24 struct Hrtf {
25 RefCount ref;
27 ALuint sampleRate;
28 ALsizei irSize;
29 ALubyte evCount;
31 const ALubyte *azCount;
32 const ALushort *evOffset;
33 const ALfloat (*coeffs)[2];
34 const ALubyte (*delays)[2];
38 void FreeHrtfs(void);
40 vector_EnumeratedHrtf EnumerateHrtf(const_al_string devname);
41 void FreeHrtfList(vector_EnumeratedHrtf *list);
42 struct Hrtf *GetLoadedHrtf(struct HrtfEntry *entry);
43 void Hrtf_IncRef(struct Hrtf *hrtf);
44 void Hrtf_DecRef(struct Hrtf *hrtf);
46 void GetHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat spread, ALfloat (*coeffs)[2], ALsizei *delays);
48 /**
49 * Produces HRTF filter coefficients for decoding B-Format, given a set of
50 * virtual speaker positions and HF/LF matrices for decoding to them. The
51 * returned coefficients are ordered and scaled according to the matrices.
52 * Returns the maximum impulse-response length of the generated coefficients.
54 ALsizei BuildBFormatHrtf(const struct Hrtf *Hrtf, DirectHrtfState *state, ALsizei NumChannels, const ALfloat (*restrict AmbiPoints)[2], const ALfloat (*restrict AmbiMatrix)[2][MAX_AMBI_COEFFS], ALsizei AmbiCount);
56 #endif /* ALC_HRTF_H */