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.h 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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_H
  20. #define __RESAMPLER_H
  21. #include "resampler-table.h"
  22. class Resampler
  23. {
  24. public:
  25. Resampler (void) noexcept;
  26. ~Resampler (void);
  27. bool setup (unsigned int fs_inp,
  28. unsigned int fs_out,
  29. unsigned int nchan,
  30. unsigned int hlen);
  31. bool setup (unsigned int fs_inp,
  32. unsigned int fs_out,
  33. unsigned int nchan,
  34. unsigned int hlen,
  35. double frel);
  36. void clear (void);
  37. bool reset (void) noexcept;
  38. int nchan (void) const noexcept { return _nchan; }
  39. int filtlen (void) const noexcept { return inpsize (); } // Deprecated
  40. int inpsize (void) const noexcept;
  41. double inpdist (void) const noexcept;
  42. bool process (void);
  43. unsigned int inp_count;
  44. unsigned int out_count;
  45. float *inp_data;
  46. float *out_data;
  47. float **inp_list;
  48. float **out_list;
  49. private:
  50. Resampler_table *_table;
  51. unsigned int _nchan;
  52. unsigned int _inmax;
  53. unsigned int _index;
  54. unsigned int _nread;
  55. unsigned int _nzero;
  56. unsigned int _phase;
  57. unsigned int _pstep;
  58. float *_buff;
  59. void *_dummy [8];
  60. };
  61. #endif