hrtf.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef ALC_HRTF_H
  2. #define ALC_HRTF_H
  3. #include "AL/al.h"
  4. #include "AL/alc.h"
  5. #include "alMain.h"
  6. #include "alstring.h"
  7. #include "atomic.h"
  8. /* The maximum number of virtual speakers used to generate HRTF coefficients
  9. * for decoding B-Format.
  10. */
  11. #define HRTF_AMBI_MAX_CHANNELS 16
  12. struct HrtfEntry;
  13. struct Hrtf {
  14. RefCount ref;
  15. ALuint sampleRate;
  16. ALsizei irSize;
  17. ALubyte evCount;
  18. const ALubyte *azCount;
  19. const ALushort *evOffset;
  20. const ALfloat (*coeffs)[2];
  21. const ALubyte (*delays)[2];
  22. };
  23. void FreeHrtfs(void);
  24. vector_EnumeratedHrtf EnumerateHrtf(const_al_string devname);
  25. void FreeHrtfList(vector_EnumeratedHrtf *list);
  26. struct Hrtf *GetLoadedHrtf(struct HrtfEntry *entry);
  27. void Hrtf_IncRef(struct Hrtf *hrtf);
  28. void Hrtf_DecRef(struct Hrtf *hrtf);
  29. void GetHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat spread, ALfloat (*coeffs)[2], ALsizei *delays);
  30. /**
  31. * Produces HRTF filter coefficients for decoding B-Format, given a set of
  32. * virtual speaker positions and HF/LF matrices for decoding to them. The
  33. * returned coefficients are ordered and scaled according to the matrices.
  34. * Returns the maximum impulse-response length of the generated coefficients.
  35. */
  36. 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);
  37. #endif /* ALC_HRTF_H */