HRTF.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. HRTF.h
  3. Copyright 2002-5 Tim Goetze <tim@quitte.de>
  4. http://quitte.de/dsp/
  5. IIR filtering based on HRTF data sets
  6. */
  7. /*
  8. This program is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU General Public License
  10. as published by the Free Software Foundation; either version 2
  11. of the License, or (at your option) any later version.
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  19. 02111-1307, USA or point your web browser to http://www.gnu.org.
  20. */
  21. #ifndef _HRTF_H_
  22. #define _HRTF_H_
  23. #include "dsp/util.h"
  24. class HRTF
  25. : public Plugin
  26. {
  27. public:
  28. int pan;
  29. int n, h;
  30. double x[32];
  31. struct {
  32. double * a, * b;
  33. double y[32];
  34. } left, right;
  35. void set_pan (int p);
  36. template <sample_func_t F>
  37. void one_cycle (int frames);
  38. public:
  39. static PortInfo port_info [];
  40. void init();
  41. void activate()
  42. {
  43. set_pan ((int) *ports[1]);
  44. }
  45. void run (int n)
  46. {
  47. one_cycle<store_func> (n);
  48. }
  49. void run_adding (int n)
  50. {
  51. one_cycle<adding_func> (n);
  52. }
  53. };
  54. #endif /* _HRTF_H_ */