Merge CV, ver=5.1; ops/methods from HV, and interface from CV where possible
[goodguy/history.git] / cinelerra-5.1 / plugins / freeverb / Components / allpass.hpp
diff --git a/cinelerra-5.1/plugins/freeverb/Components/allpass.hpp b/cinelerra-5.1/plugins/freeverb/Components/allpass.hpp
new file mode 100644 (file)
index 0000000..35e56e7
--- /dev/null
@@ -0,0 +1,53 @@
+// Allpass filter declaration\r
+//\r
+// Written by Jezar at Dreampoint, June 2000\r
+// http://www.dreampoint.co.uk\r
+// This code is public domain\r
+\r
+#ifndef _allpass_\r
+#define _allpass_\r
+#include "denormals.h"\r
+\r
+class allpass\r
+{\r
+public:\r
+                                       allpass();\r
+                       void    setbuffer(float *buf, int size);\r
+       inline  float   process(float inp);\r
+                       void    mute();\r
+                       void    setfeedback(float val);\r
+                       float   getfeedback();\r
+// private:\r
+       float   feedback;\r
+       float   *buffer;\r
+       int             bufsize;\r
+       int             bufidx;\r
+};\r
+\r
+\r
+// Big to inline - but crucial for speed\r
+\r
+inline float allpass::process(float input)\r
+{\r
+       float output;\r
+       float bufout;\r
+       \r
+       bufout = buffer[bufidx];\r
+       undenormalise(bufout);\r
+       \r
+       output = -input + bufout;\r
+       buffer[bufidx] = input + (bufout*feedback);\r
+\r
+       if(++bufidx>=bufsize) bufidx = 0;\r
+\r
+       return output;\r
+}\r
+\r
+#endif//_allpass\r
+\r
+//ends\r
+\r
+\r
+\r
+\r
+\r