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.

resampler-table.h 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // ----------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 2006-2023 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 "CarlaDefines.h"
  22. #include <pthread.h>
  23. class Resampler_mutex
  24. {
  25. private:
  26. friend class Resampler_table;
  27. Resampler_mutex (void) { pthread_mutex_init (&_mutex, nullptr); }
  28. ~Resampler_mutex (void) { pthread_mutex_destroy (&_mutex); }
  29. void lock (void) { pthread_mutex_lock (&_mutex); }
  30. void unlock (void) { pthread_mutex_unlock (&_mutex); }
  31. pthread_mutex_t _mutex;
  32. };
  33. class Resampler_table
  34. {
  35. private:
  36. Resampler_table (double fr, unsigned int hl, unsigned int np);
  37. ~Resampler_table (void);
  38. friend class Resampler;
  39. friend class VResampler;
  40. Resampler_table *_next;
  41. unsigned int _refc;
  42. float *_ctab;
  43. double _fr;
  44. unsigned int _hl;
  45. unsigned int _np;
  46. static Resampler_table *create (double fr, unsigned int hl, unsigned int np);
  47. static void destroy (Resampler_table *T);
  48. static Resampler_table *_list;
  49. static Resampler_mutex _mutex;
  50. };
  51. #endif