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.

Echo.h 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. Echo.h - Echo Effect
  4. Copyright (C) 2002-2005 Nasca Octavian Paul
  5. Author: Nasca Octavian Paul
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of version 2 of the GNU General Public License
  8. as published by the Free Software Foundation.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License (version 2 or later) for more details.
  13. You should have received a copy of the GNU General Public License (version 2)
  14. along with this program; if not, write to the Free Software Foundation,
  15. Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. */
  17. #ifndef ECHO_H
  18. #define ECHO_H
  19. #include "Effect.h"
  20. #include "../Misc/Stereo.h"
  21. /**Echo Effect*/
  22. class Echo:public Effect
  23. {
  24. public:
  25. Echo(EffectParams pars);
  26. ~Echo();
  27. void out(const Stereo<float *> &input);
  28. void setpreset(unsigned char npreset);
  29. /**
  30. * Sets the value of the chosen variable
  31. *
  32. * The possible parameters are:
  33. * -# Volume
  34. * -# Panning
  35. * -# Delay
  36. * -# L/R Delay
  37. * -# L/R Crossover
  38. * -# Feedback
  39. * -# Dampening
  40. * @param npar number of chosen parameter
  41. * @param value the new value
  42. */
  43. void changepar(int npar, unsigned char value);
  44. /**
  45. * Gets the specified parameter
  46. *
  47. * The possible parameters are
  48. * -# Volume
  49. * -# Panning
  50. * -# Delay
  51. * -# L/R Delay
  52. * -# L/R Crossover
  53. * -# Feedback
  54. * -# Dampening
  55. * @param npar number of chosen parameter
  56. * @return value of parameter
  57. */
  58. unsigned char getpar(int npar) const;
  59. int getnumparams(void);
  60. void cleanup(void);
  61. private:
  62. //Parameters
  63. unsigned char Pvolume; /**<#1 Volume or Dry/Wetness*/
  64. unsigned char Pdelay; /**<#3 Delay of the Echo*/
  65. unsigned char Plrdelay; /**<#4 L/R delay difference*/
  66. unsigned char Pfb; /**<#6Feedback*/
  67. unsigned char Phidamp; /**<#7Dampening of the Echo*/
  68. void setvolume(unsigned char _Pvolume);
  69. void setdelay(unsigned char _Pdelay);
  70. void setlrdelay(unsigned char _Plrdelay);
  71. void setfb(unsigned char _Pfb);
  72. void sethidamp(unsigned char _Phidamp);
  73. //Real Parameters
  74. float fb, hidamp;
  75. //Left/Right delay lengths
  76. Stereo<int> delayTime;
  77. float lrdelay;
  78. float avgDelay;
  79. void initdelays(void);
  80. //2 channel ring buffer
  81. Stereo<float *> delay;
  82. Stereo<float> old;
  83. //position of reading/writing from delaysample
  84. Stereo<int> pos;
  85. //step size for delay buffer
  86. Stereo<int> delta;
  87. Stereo<int> ndelta;
  88. };
  89. #endif