Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.9KB

  1. // ----------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 2006-2012 Fons Adriaensen <fons@linuxaudio.org>
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License as published by
  7. // the Free Software Foundation; either version 3 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. // GNU General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. //
  18. // ----------------------------------------------------------------------------
  19. #ifndef __RESAMPLER_TABLE_H
  20. #define __RESAMPLER_TABLE_H
  21. #include <pthread.h>
  22. class Resampler_mutex
  23. {
  24. private:
  25. friend class Resampler_table;
  26. Resampler_mutex (void) { pthread_mutex_init (&_mutex, nullptr); }
  27. ~Resampler_mutex (void) { pthread_mutex_destroy (&_mutex); }
  28. void lock (void) { pthread_mutex_lock (&_mutex); }
  29. void unlock (void) { pthread_mutex_unlock (&_mutex); }
  30. pthread_mutex_t _mutex;
  31. };
  32. class Resampler_table
  33. {
  34. public:
  35. static void print_list (void);
  36. private:
  37. Resampler_table (double fr, unsigned int hl, unsigned int np);
  38. ~Resampler_table (void);
  39. friend class Resampler;
  40. friend class VResampler;
  41. Resampler_table *_next;
  42. unsigned int _refc;
  43. float *_ctab;
  44. double _fr;
  45. unsigned int _hl;
  46. unsigned int _np;
  47. static Resampler_table *create (double fr, unsigned int hl, unsigned int np);
  48. static void destroy (Resampler_table *T);
  49. static Resampler_table *_list;
  50. static Resampler_mutex _mutex;
  51. };
  52. #endif