nfcfilter.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef NFCFILTER_H
  2. #define NFCFILTER_H
  3. #include "alMain.h"
  4. typedef struct NfcFilter {
  5. float g;
  6. float coeffs[MAX_AMBI_ORDER*2 + 1];
  7. float history[MAX_AMBI_ORDER];
  8. } NfcFilter;
  9. /* NOTE:
  10. * w0 = speed_of_sound / (source_distance * sample_rate);
  11. * w1 = speed_of_sound / (control_distance * sample_rate);
  12. *
  13. * Generally speaking, the control distance should be approximately the average
  14. * speaker distance, or based on the reference delay if outputing NFC-HOA. It
  15. * must not be negative, 0, or infinite. The source distance should not be too
  16. * small relative to the control distance.
  17. */
  18. /* Near-field control filter for first-order ambisonic channels (1-3). */
  19. void NfcFilterCreate1(NfcFilter *nfc, const float w0, const float w1);
  20. void NfcFilterAdjust1(NfcFilter *nfc, const float w0);
  21. void NfcFilterUpdate1(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count);
  22. /* Near-field control filter for second-order ambisonic channels (4-8). */
  23. void NfcFilterCreate2(NfcFilter *nfc, const float w0, const float w1);
  24. void NfcFilterAdjust2(NfcFilter *nfc, const float w0);
  25. void NfcFilterUpdate2(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count);
  26. /* Near-field control filter for third-order ambisonic channels (9-15). */
  27. void NfcFilterCreate3(NfcFilter *nfc, const float w0, const float w1);
  28. void NfcFilterAdjust3(NfcFilter *nfc, const float w0);
  29. void NfcFilterUpdate3(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count);
  30. #endif /* NFCFILTER_H */