hrtf.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef ALC_HRTF_H
  2. #define ALC_HRTF_H
  3. #include "AL/al.h"
  4. #include "AL/alc.h"
  5. #include "alstring.h"
  6. struct Hrtf {
  7. ALuint sampleRate;
  8. ALuint irSize;
  9. ALubyte evCount;
  10. const ALubyte *azCount;
  11. const ALushort *evOffset;
  12. const ALshort *coeffs;
  13. const ALubyte *delays;
  14. const char *filename;
  15. struct Hrtf *next;
  16. };
  17. typedef struct HrtfEntry {
  18. al_string name;
  19. const struct Hrtf *hrtf;
  20. } HrtfEntry;
  21. TYPEDEF_VECTOR(HrtfEntry, vector_HrtfEntry)
  22. #define HRIR_BITS (7)
  23. #define HRIR_LENGTH (1<<HRIR_BITS)
  24. #define HRIR_MASK (HRIR_LENGTH-1)
  25. #define HRTFDELAY_BITS (20)
  26. #define HRTFDELAY_FRACONE (1<<HRTFDELAY_BITS)
  27. #define HRTFDELAY_MASK (HRTFDELAY_FRACONE-1)
  28. void FreeHrtfs(void);
  29. vector_HrtfEntry EnumerateHrtf(const_al_string devname);
  30. void FreeHrtfList(vector_HrtfEntry *list);
  31. void GetHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat spread, ALfloat gain, ALfloat (*coeffs)[2], ALuint *delays);
  32. /* Produces HRTF filter coefficients for decoding B-Format. The result will
  33. * have ACN ordering with N3D normalization. NumChannels must currently be 4,
  34. * for first-order. Returns the maximum impulse-response length of the
  35. * generated coefficients.
  36. */
  37. ALuint BuildBFormatHrtf(const struct Hrtf *Hrtf, ALfloat (*coeffs)[HRIR_LENGTH][2], ALuint NumChannels);
  38. #endif /* ALC_HRTF_H */