SuperpoweredReverb.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #ifndef Header_SuperpoweredReverb
  2. #define Header_SuperpoweredReverb
  3. #include "SuperpoweredFX.h"
  4. struct reverbInternals;
  5. /**
  6. @brief CPU-friendly reverb.
  7. One instance allocates around 120 kb memory.
  8. @param dry >= 0.0f and <= 1.0f. Read only.
  9. @param wet >= 0.0f and <= 1.0f. Read only.
  10. @param mix >= 0.0f and <= 1.0f. Read only.
  11. @param width >= 0.0f and <= 1.0f. Read only.
  12. @param damp >= 0.0f and <= 1.0f. Read only.
  13. @param roomSize >= 0.0f and <= 1.0f. Read only.
  14. */
  15. class SuperpoweredReverb: public SuperpoweredFX {
  16. public:
  17. // READ ONLY parameters, don't set them directly, use the methods below.
  18. float dry, wet;
  19. float mix;
  20. float width;
  21. float damp;
  22. float roomSize;
  23. /**
  24. @brief You can set dry and wet independently, but don't use setMix in this case.
  25. @param value Limited to >= 0.0f and <= 1.0f.
  26. */
  27. void setDry(float value);
  28. /**
  29. @brief You can set dry and wet independently, but don't use setMix in this case.
  30. @param value Limited to >= 0.0f and <= 1.0f.
  31. */
  32. void setWet(float value);
  33. /**
  34. @brief Mix has a nice dry/wet constant power curve. Don't use setDry() and setWet() with this.
  35. @param value Limited to >= 0.0f and <= 1.0f.
  36. */
  37. void setMix(float value);
  38. /**
  39. @brief Sets stereo width.
  40. @param value Limited to >= 0.0f and <= 1.0f.
  41. */
  42. void setWidth(float value);
  43. /**
  44. @brief Sets high frequency damping.
  45. @param value Limited to >= 0.0f and <= 1.0f.
  46. */
  47. void setDamp(float value);
  48. /**
  49. @brief Adjust room size.
  50. @param value Limited to >= 0.0f and <= 1.0f.
  51. */
  52. void setRoomSize(float value);
  53. /**
  54. @brief Turns the effect on/off.
  55. */
  56. void enable(bool flag);
  57. /**
  58. @brief Create a reverb instance with the current sample rate value.
  59. Enabled is false by default, use enable(true) to enable.
  60. */
  61. SuperpoweredReverb(unsigned int samplerate);
  62. ~SuperpoweredReverb();
  63. /**
  64. @brief Sets the sample rate.
  65. @param samplerate 44100, 48000, etc.
  66. */
  67. void setSamplerate(unsigned int samplerate);
  68. /**
  69. @brief Reset all internals, sets the instance as good as new and turns it off.
  70. */
  71. void reset();
  72. /**
  73. @brief Processes the audio.
  74. It's not locked when you call other methods from other threads, and they not interfere with process() at all.
  75. @return Put something into output or not.
  76. @param input 32-bit interleaved stereo input buffer. Can point to the same location with output (in-place processing). Special case: input can be NULL, reverb will output the tail only this case.
  77. @param output 32-bit interleaved stereo output buffer. Can point to the same location with input (in-place processing).
  78. @param numberOfSamples Should be 16 minimum, and a multiply of 8.
  79. */
  80. bool process(float *input, float *output, unsigned int numberOfSamples);
  81. private:
  82. reverbInternals *internals;
  83. SuperpoweredReverb(const SuperpoweredReverb&);
  84. SuperpoweredReverb& operator=(const SuperpoweredReverb&);
  85. };
  86. #endif