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.

102 lines
2.7KB

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