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.

Chorus.h 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. Chorus.h - Chorus and Flange effects
  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 CHORUS_H
  18. #define CHORUS_H
  19. #include "Effect.h"
  20. #include "EffectLFO.h"
  21. #include "../Misc/Stereo.h"
  22. #define MAX_CHORUS_DELAY 250.0f //ms
  23. /**Chorus and Flange effects*/
  24. class Chorus:public Effect
  25. {
  26. public:
  27. Chorus(bool insertion_, float *efxoutl_, float *efxoutr_);
  28. /**Destructor*/
  29. ~Chorus();
  30. void out(const Stereo<float *> &input);
  31. void setpreset(unsigned char npreset);
  32. /**
  33. * Sets the value of the chosen variable
  34. *
  35. * The possible parameters are:
  36. * -# Volume
  37. * -# Panning
  38. * -# LFO Frequency
  39. * -# LFO Randomness
  40. * -# LFO Type
  41. * -# LFO stereo
  42. * -# Depth
  43. * -# Delay
  44. * -# Feedback
  45. * -# Flange Mode
  46. * -# Subtractive
  47. * @param npar number of chosen parameter
  48. * @param value the new value
  49. */
  50. void changepar(int npar, unsigned char value);
  51. /**
  52. * Gets the value of the chosen variable
  53. *
  54. * The possible parameters are:
  55. * -# Volume
  56. * -# Panning
  57. * -# LFO Frequency
  58. * -# LFO Randomness
  59. * -# LFO Type
  60. * -# LFO stereo
  61. * -# Depth
  62. * -# Delay
  63. * -# Feedback
  64. * -# Flange Mode
  65. * -# Subtractive
  66. * @param npar number of chosen parameter
  67. * @return the value of the parameter
  68. */
  69. unsigned char getpar(int npar) const;
  70. void cleanup(void);
  71. private:
  72. //Chorus Parameters
  73. unsigned char Pvolume;
  74. unsigned char Pdepth; //the depth of the Chorus(ms)
  75. unsigned char Pdelay; //the delay (ms)
  76. unsigned char Pfb; //feedback
  77. unsigned char Pflangemode; //how the LFO is scaled, to result chorus or flange
  78. unsigned char Poutsub; //if I wish to substract the output instead of the adding it
  79. EffectLFO lfo; //lfo-ul chorus
  80. //Parameter Controls
  81. void setvolume(unsigned char _Pvolume);
  82. void setdepth(unsigned char _Pdepth);
  83. void setdelay(unsigned char _Pdelay);
  84. void setfb(unsigned char _Pfb);
  85. //Internal Values
  86. float depth, delay, fb;
  87. float dl1, dl2, dr1, dr2, lfol, lfor;
  88. int maxdelay;
  89. Stereo<float *> delaySample;
  90. int dlk, drk, dlhi;
  91. float getdelay(float xlfo);
  92. };
  93. #endif