summaryrefslogtreecommitdiffstats
path: root/arts/modules/effects/freeverb/allpass.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'arts/modules/effects/freeverb/allpass.hpp')
-rw-r--r--arts/modules/effects/freeverb/allpass.hpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/arts/modules/effects/freeverb/allpass.hpp b/arts/modules/effects/freeverb/allpass.hpp
new file mode 100644
index 00000000..853c7d41
--- /dev/null
+++ b/arts/modules/effects/freeverb/allpass.hpp
@@ -0,0 +1,48 @@
+// Allpass filter declaration
+//
+// Written by Jezar at Dreampoint, June 2000
+// http://www.dreampoint.co.uk
+// This code is public domain
+
+#ifndef _allpass_
+#define _allpass_
+#include "denormals.h"
+
+class allpass
+{
+public:
+ allpass();
+ void setbuffer(float *buf, int size);
+ inline float process(float inp);
+ void mute();
+ void setfeedback(float val);
+ float getfeedback();
+// private:
+ float feedback;
+ float *buffer;
+ int bufsize;
+ int bufidx;
+};
+
+
+// Big to inline - but crucial for speed
+
+inline float allpass::process(float input)
+{
+ float output;
+ float bufout;
+
+ bufout = buffer[bufidx];
+ undenormalise(bufout);
+
+ output = -input + bufout;
+ buffer[bufidx] = input + (bufout*feedback);
+
+ if(++bufidx>=bufsize) bufidx = 0;
+
+ return output;
+}
+
+#endif//_allpass
+
+//ends