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.

85 lines
2.3KB

  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 __VRESAMPLER_H
  20. #define __VRESAMPLER_H
  21. #include "resampler-table.h"
  22. class VResampler
  23. {
  24. public:
  25. VResampler (void) noexcept;
  26. ~VResampler (void);
  27. bool setup (double ratio,
  28. unsigned int nchan,
  29. unsigned int hlen);
  30. bool setup (double ratio,
  31. unsigned int nchan,
  32. unsigned int hlen,
  33. double frel);
  34. void clear (void);
  35. bool reset (void) noexcept;
  36. int nchan (void) const noexcept { return _nchan; }
  37. int inpsize (void) const noexcept;
  38. double inpdist (void) const noexcept;
  39. bool process (void);
  40. void set_phase (double p);
  41. void set_rrfilt (double t);
  42. void set_rratio (double r);
  43. unsigned int inp_count;
  44. unsigned int out_count;
  45. float *inp_data;
  46. float *out_data;
  47. void *inp_list;
  48. void *out_list;
  49. private:
  50. enum { NPHASE = 120 };
  51. Resampler_table *_table;
  52. unsigned int _nchan;
  53. unsigned int _inmax;
  54. unsigned int _index;
  55. unsigned int _nread;
  56. unsigned int _nzero;
  57. double _ratio;
  58. double _phase;
  59. double _pstep;
  60. double _qstep;
  61. double _wstep;
  62. float *_buff;
  63. float *_c1;
  64. float *_c2;
  65. void *_dummy [8];
  66. };
  67. #endif