summaryrefslogtreecommitdiff
path: root/muse_qt4_evolution/plugins/freeverb/comb.h
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2009-12-27 11:30:35 +0000
committerRobert Jonsson <spamatica@gmail.com>2009-12-27 11:30:35 +0000
commitb703eab295330e6f81564fbb39a10a1a2fdd2f54 (patch)
treee46b5c9a6bc22fd661c15d1d2123f5bf631cef80 /muse_qt4_evolution/plugins/freeverb/comb.h
parent5d5fa0fdf913907edbc3d2d29a7548f0cb658c94 (diff)
moved old qt4 branch
Diffstat (limited to 'muse_qt4_evolution/plugins/freeverb/comb.h')
-rw-r--r--muse_qt4_evolution/plugins/freeverb/comb.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/muse_qt4_evolution/plugins/freeverb/comb.h b/muse_qt4_evolution/plugins/freeverb/comb.h
new file mode 100644
index 00000000..22f5591b
--- /dev/null
+++ b/muse_qt4_evolution/plugins/freeverb/comb.h
@@ -0,0 +1,63 @@
+// Comb filter class declaration
+//
+// Written by Jezar at Dreampoint, June 2000
+// http://www.dreampoint.co.uk
+// This code is public domain
+
+#ifndef _comb_
+#define _comb_
+
+#include "denormals.h"
+
+
+//---------------------------------------------------------
+// comb
+//---------------------------------------------------------
+
+class comb
+ {
+ float feedback;
+ float filterstore;
+ float damp1;
+ float damp2;
+ float *buffer;
+ int bufsize;
+ int bufidx;
+
+public:
+ comb() {
+ filterstore = 0;
+ bufidx = 0;
+ }
+ void setbuffer(float *buf, int size) {
+ buffer = buf;
+ bufsize = size;
+ }
+ float process(float input) {
+ float output = buffer[bufidx];
+ undenormalise(output);
+ filterstore = (output*damp2) + (filterstore*damp1);
+ undenormalise(filterstore);
+ buffer[bufidx] = input + (filterstore*feedback);
+ if (++bufidx >= bufsize)
+ bufidx = 0;
+// bufidx = ++bufidx % bufsize;
+ return output;
+ }
+ void mute() {
+ for (int i=0; i<bufsize; i++)
+ buffer[i]=0;
+ }
+ void setdamp(float val) {
+ damp1 = val;
+ damp2 = 1-val;
+ }
+ float getdamp() { return damp1; }
+ void setfeedback(float val) { feedback = val; }
+ float getfeedback() { return feedback; }
+ };
+
+
+#endif //_comb_
+
+//ends