SuperpoweredFlanger.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef Header_SuperpoweredFlanger
  2. #define Header_SuperpoweredFlanger
  3. #include "SuperpoweredFX.h"
  4. struct flangerInternals;
  5. /**
  6. @brief Flanger with aggressive sound ("jet").
  7. One instance allocates around 80 kb memory.
  8. @param wet 0.0f to 1.0f. Read only.
  9. @param depthMs Depth in milliseconds, 0.3f to 8.0f (0.3 ms to 8 ms). Read only.
  10. @param depth 0.0f to 1.0f (0.0 is 0.3 ms, 1.0 is 8 ms). Read only.
  11. @param lfoBeats The length in beats between the "lowest" and the "highest" jet sound, >= 0.25f and <= 64.0f. Read only.
  12. @param bpm Set this right for a nice sounding lfo. Limited to >= 60.0f and <= 240.0f. Read-write.
  13. @param clipperThresholdDb The flanger has a SuperpoweredClipper inside to prevent overdrive. This is it's thresholdDb parameter.
  14. @param clipperMaximumDb The flanger has a SuperpoweredClipper inside to prevent overdrive. This is it's maximumDb parameter.
  15. @param stereo Stereo/mono switch. Read-write.
  16. */
  17. class SuperpoweredFlanger: public SuperpoweredFX {
  18. public:
  19. // READ ONLY parameters, don't set them directly, use the methods below.
  20. float wet;
  21. float depthMs;
  22. float depth;
  23. float lfoBeats;
  24. // READ-WRITE parameters, thread safe (change from any thread)
  25. float bpm;
  26. float clipperThresholdDb;
  27. float clipperMaximumDb;
  28. bool stereo;
  29. /**
  30. @brief Set wet.
  31. @param value 0.0f to 1.0f
  32. */
  33. void setWet(float value);
  34. /**
  35. @brief Set depth.
  36. @param value 0.0f to 1.0f
  37. */
  38. void setDepth(float value);
  39. /**
  40. @brief Set LFO, adjustable with beats.
  41. @param beats >= 0.25f and <= 64.0f
  42. */
  43. void setLFOBeats(float beats);
  44. /**
  45. @brief Turns the effect on/off.
  46. */
  47. void enable(bool flag);
  48. /**
  49. @brief Create a flanger instance with the current sample rate value.
  50. Enabled is false by default, use enable(true) to enable.
  51. */
  52. SuperpoweredFlanger(unsigned int samplerate);
  53. ~SuperpoweredFlanger();
  54. /**
  55. @brief Sets the sample rate.
  56. @param samplerate 44100, 48000, etc.
  57. */
  58. void setSamplerate(unsigned int samplerate);
  59. /**
  60. @brief Reset all internals, sets the instance as good as new and turns it off.
  61. */
  62. void reset();
  63. /**
  64. @brief Processes the audio.
  65. It's not locked when you call other methods from other threads, and they not interfere with process() at all.
  66. @return Put something into output or not.
  67. @param input 32-bit interleaved stereo input buffer. Can point to the same location with output (in-place processing).
  68. @param output 32-bit interleaved stereo output buffer. Can point to the same location with input (in-place processing).
  69. @param numberOfSamples Should be 16 minimum and exactly divisible with 4.
  70. */
  71. bool process(float *input, float *output, unsigned int numberOfSamples);
  72. private:
  73. flangerInternals *internals;
  74. SuperpoweredFlanger(const SuperpoweredFlanger&);
  75. SuperpoweredFlanger& operator=(const SuperpoweredFlanger&);
  76. };
  77. #endif