SuperpoweredEcho.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef Header_SuperpoweredEcho
  2. #define Header_SuperpoweredEcho
  3. #include "SuperpoweredFX.h"
  4. struct echoInternals;
  5. /**
  6. @brief Simple echo.
  7. One instance allocates around 770 kb memory.
  8. @param dry >= 0.0f and <= 1.0f. Read only.
  9. @param wet >= 0.0f and <= 1.0f. Read only.
  10. @param bpm >= 60.0f and <= 240.0f. Read-write.
  11. @param beats Delay in beats, >= 0.125f and <= 2.0f. Read-write.
  12. @param decay >= 0.0f and <= 1.0f. Read-write.
  13. */
  14. class SuperpoweredEcho: public SuperpoweredFX {
  15. public:
  16. // READ ONLY parameters, don't set them directly, use the methods below.
  17. float dry, wet;
  18. // READ-WRITE PARAMETERS:
  19. float bpm;
  20. float beats;
  21. float decay;
  22. /**
  23. @brief Wet is always == mix, but dry changes with a nice curve for a good echo/dry balance.
  24. @param mix >= 0.0f and <= 1.0f.
  25. */
  26. void setMix(float mix);
  27. /**
  28. @brief Turns the effect on/off.
  29. */
  30. void enable(bool flag);
  31. /**
  32. @brief Create an echo instance with the current sample rate value.
  33. Enabled is false by default, use enable(true) to enable.
  34. */
  35. SuperpoweredEcho(unsigned int samplerate);
  36. ~SuperpoweredEcho();
  37. /**
  38. @brief Sets the sample rate.
  39. @param samplerate 44100, 48000, etc.
  40. */
  41. void setSamplerate(unsigned int samplerate); // 44100, 48000, etc.
  42. /**
  43. @brief Reset all internals, sets the instance as good as new and turns it off.
  44. */
  45. void reset();
  46. /**
  47. @brief Processes the audio.
  48. It's not locked when you call other methods from other threads, and they not interfere with process() at all.
  49. @return Put something into output or not.
  50. @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, echo will output the tail only this case.
  51. @param output 32-bit interleaved stereo output buffer. Can point to the same location with input (in-place processing).
  52. @param numberOfSamples Should be 16 minimum, and a multiply of 8.
  53. */
  54. bool process(float *input, float *output, unsigned int numberOfSamples);
  55. private:
  56. echoInternals *internals;
  57. SuperpoweredEcho(const SuperpoweredEcho&);
  58. SuperpoweredEcho& operator=(const SuperpoweredEcho&);
  59. };
  60. #endif