Click.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. Click.h
  3. Copyright 2004-5 Tim Goetze <tim@quitte.de>
  4. http://quitte.de/dsp/
  5. units perpetually repeating a recorded sample.
  6. */
  7. /*
  8. This program is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU General Public License
  10. as published by the Free Software Foundation; either version 2
  11. of the License, or (at your option) any later version.
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  19. 02111-1307, USA or point your web browser to http://www.gnu.org.
  20. */
  21. #ifndef _CLICK_H_
  22. #define _CLICK_H_
  23. #include "dsp/OnePole.h"
  24. #include "dsp/util.h"
  25. class ClickStub
  26. : public Plugin
  27. {
  28. public:
  29. sample_t bpm;
  30. float * wave;
  31. int N; /* number of samples in wave */
  32. DSP::OnePoleLP lp;
  33. int period; /* frames remaining in period */
  34. int played; /* frames played from sample */
  35. template <sample_func_t F>
  36. void one_cycle (int frames);
  37. public:
  38. static PortInfo port_info [];
  39. void init (float * _wave, int _N);
  40. void activate()
  41. {
  42. played = 0;
  43. period = 0;
  44. }
  45. void run (int n)
  46. {
  47. one_cycle<store_func> (n);
  48. }
  49. void run_adding (int n)
  50. {
  51. one_cycle<adding_func> (n);
  52. }
  53. };
  54. class Click
  55. : public ClickStub
  56. {
  57. public:
  58. void init();
  59. };
  60. class CEO
  61. : public ClickStub
  62. {
  63. public:
  64. void init();
  65. static PortInfo port_info [];
  66. };
  67. class Dirac
  68. : public ClickStub
  69. {
  70. public:
  71. void init();
  72. static PortInfo port_info [];
  73. };
  74. #endif /* _CLICK_H_ */