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.

99 lines
2.8KB

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