SuperpoweredRoll.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef Header_SuperpoweredRoll
  2. #define Header_SuperpoweredRoll
  3. #include "SuperpoweredFX.h"
  4. struct rollInternals;
  5. /**
  6. @brief Bpm/beat based loop roll effect.
  7. One instance allocates around 1600 kb memory.
  8. @param wet Limited to >= 0.0f and <= 1.0f.
  9. @param bpm Limited to >= 60.0f and <= 240.0f
  10. @param beats Limit: 1/64 beats to 4 beats. (>= 0.015625f and <= 4.0f)
  11. */
  12. class SuperpoweredRoll: public SuperpoweredFX {
  13. public:
  14. // READ-WRITE parameters, thread safe (change from any thread)
  15. float wet;
  16. float bpm;
  17. float beats;
  18. /**
  19. @brief Turns the effect on/off.
  20. */
  21. void enable(bool flag);
  22. /**
  23. @brief Create a roll instance with the current sample rate value.
  24. Enabled is false by default, use enable(true) to enable.
  25. */
  26. SuperpoweredRoll(unsigned int samplerate);
  27. ~SuperpoweredRoll();
  28. /**
  29. @brief Sets the sample rate.
  30. @param samplerate 44100, 48000, etc.
  31. */
  32. void setSamplerate(unsigned int samplerate);
  33. /**
  34. @brief Reset all internals, sets the instance as good as new and turns it off.
  35. */
  36. void reset();
  37. /**
  38. @brief Processes the audio.
  39. It's not locked when you call other methods from other threads, and they not interfere with process() at all.
  40. @return Put something into output or not.
  41. @param input 32-bit interleaved stereo input buffer. Can point to the same location with output (in-place processing). Special case: can be NULL, roll will loop what's "recorded" before.
  42. @param output 32-bit interleaved stereo output buffer. Can point to the same location with input (in-place processing).
  43. @param numberOfSamples Should be 16 minimum.
  44. */
  45. bool process(float *input, float *output, unsigned int numberOfSamples);
  46. private:
  47. rollInternals *internals;
  48. SuperpoweredRoll(const SuperpoweredRoll&);
  49. SuperpoweredRoll& operator=(const SuperpoweredRoll&);
  50. };
  51. #endif