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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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_H
  20. #define __RESAMPLER_H
  21. #include "resampler-table.h"
  22. class Resampler
  23. {
  24. public:
  25. Resampler (void) noexcept;
  26. ~Resampler (void);
  27. int setup (unsigned int fs_inp,
  28. unsigned int fs_out,
  29. unsigned int nchan,
  30. unsigned int hlen);
  31. int 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. unsigned int nchan (void) const noexcept { return _nchan; }
  39. unsigned int filtlen (void) const noexcept { return inpsize (); } // Deprecated
  40. unsigned 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. void *inp_list;
  48. void *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. };
  60. #endif