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.

allpass.hpp 823B

11 years ago
11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Allpass filter declaration
  2. //
  3. // Written by Jezar at Dreampoint, June 2000
  4. // http://www.dreampoint.co.uk
  5. // This code is public domain
  6. #ifndef _allpass_
  7. #define _allpass_
  8. #include "denormals.h"
  9. class allpass
  10. {
  11. public:
  12. allpass();
  13. void setbuffer(float *buf, int size);
  14. inline float process(float inp);
  15. void mute();
  16. void setfeedback(float val);
  17. float getfeedback();
  18. // private:
  19. float feedback;
  20. float *buffer;
  21. int bufsize;
  22. int bufidx;
  23. };
  24. // Big to inline - but crucial for speed
  25. inline float allpass::process(float input)
  26. {
  27. float output;
  28. float bufout;
  29. bufout = buffer[bufidx];
  30. undenormalise(bufout);
  31. output = -input + bufout;
  32. buffer[bufidx] = input + (bufout*feedback);
  33. if(++bufidx>=bufsize) bufidx = 0;
  34. return output;
  35. }
  36. #endif//_allpass
  37. //ends