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.

cresampler.h 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // ----------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 2013 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 __CRESAMPLER_H
  20. #define __CRESAMPLER_H
  21. class CResampler
  22. {
  23. public:
  24. CResampler (void);
  25. ~CResampler (void);
  26. int setup (double ratio,
  27. unsigned int nchan);
  28. void clear (void);
  29. int reset (void);
  30. int nchan (void) const { return _nchan; }
  31. int inpsize (void) const;
  32. double inpdist (void) const;
  33. int process (void);
  34. void set_ratio (double r);
  35. void set_phase (double p);
  36. unsigned int inp_count;
  37. unsigned int out_count;
  38. float *inp_data;
  39. float *out_data;
  40. void *inp_list;
  41. void *out_list;
  42. private:
  43. unsigned int _nchan;
  44. unsigned int _inmax;
  45. unsigned int _index;
  46. unsigned int _nread;
  47. unsigned int _nzero;
  48. double _phase;
  49. double _pstep;
  50. float *_buff;
  51. };
  52. #endif