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.

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