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.

98 lines
2.6KB

  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
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or (at your option) any later version.
  10. */
  11. #ifndef ECHO_H
  12. #define ECHO_H
  13. #include "Effect.h"
  14. #include "../Misc/Stereo.h"
  15. /**Echo Effect*/
  16. class Echo:public Effect
  17. {
  18. public:
  19. Echo(EffectParams pars);
  20. ~Echo();
  21. void out(const Stereo<float *> &input);
  22. void setpreset(unsigned char npreset);
  23. /**
  24. * Sets the value of the chosen variable
  25. *
  26. * The possible parameters are:
  27. * -# Volume
  28. * -# Panning
  29. * -# Delay
  30. * -# L/R Delay
  31. * -# L/R Crossover
  32. * -# Feedback
  33. * -# Dampening
  34. * @param npar number of chosen parameter
  35. * @param value the new value
  36. */
  37. void changepar(int npar, unsigned char value);
  38. /**
  39. * Gets the specified parameter
  40. *
  41. * The possible parameters are
  42. * -# Volume
  43. * -# Panning
  44. * -# Delay
  45. * -# L/R Delay
  46. * -# L/R Crossover
  47. * -# Feedback
  48. * -# Dampening
  49. * @param npar number of chosen parameter
  50. * @return value of parameter
  51. */
  52. unsigned char getpar(int npar) const;
  53. int getnumparams(void);
  54. void cleanup(void);
  55. static rtosc::Ports ports;
  56. private:
  57. //Parameters
  58. unsigned char Pvolume; /**<#1 Volume or Dry/Wetness*/
  59. unsigned char Pdelay; /**<#3 Delay of the Echo*/
  60. unsigned char Plrdelay; /**<#4 L/R delay difference*/
  61. unsigned char Pfb; /**<#6Feedback*/
  62. unsigned char Phidamp; /**<#7Dampening of the Echo*/
  63. void setvolume(unsigned char _Pvolume);
  64. void setdelay(unsigned char _Pdelay);
  65. void setlrdelay(unsigned char _Plrdelay);
  66. void setfb(unsigned char _Pfb);
  67. void sethidamp(unsigned char _Phidamp);
  68. //Real Parameters
  69. float fb, hidamp;
  70. //Left/Right delay lengths
  71. Stereo<int> delayTime;
  72. float lrdelay;
  73. float avgDelay;
  74. void initdelays(void);
  75. //2 channel ring buffer
  76. Stereo<float *> delay;
  77. Stereo<float> old;
  78. //position of reading/writing from delaysample
  79. Stereo<int> pos;
  80. //step size for delay buffer
  81. Stereo<int> delta;
  82. Stereo<int> ndelta;
  83. };
  84. #endif