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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 "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. public:
  36. static void print_list (void);
  37. private:
  38. Resampler_table (double fr, unsigned int hl, unsigned int np);
  39. ~Resampler_table (void);
  40. friend class Resampler;
  41. friend class VResampler;
  42. Resampler_table *_next;
  43. unsigned int _refc;
  44. float *_ctab;
  45. double _fr;
  46. unsigned int _hl;
  47. unsigned int _np;
  48. static Resampler_table *create (double fr, unsigned int hl, unsigned int np);
  49. static void destroy (Resampler_table *T);
  50. static Resampler_table *_list;
  51. static Resampler_mutex _mutex;
  52. };
  53. #endif