Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
comb.hpp
Go to the documentation of this file.
1 // Comb filter class declaration
2//
3// Written by Jezar at Dreampoint, June 2000
4// http://www.dreampoint.co.uk
5// This code is public domain
6
7#ifndef _comb_
8#define _comb_
9
10#include "denormals.h"
11
12class comb
13{
14public:
15 comb();
16 void setbuffer(float *buf, int size);
17 inline float process(float inp);
18 void mute();
19 void setdamp(float val, int mode);
20 float getdamp();
21 void setfeedback(float val);
22 float getfeedback();
23private:
24 float feedback;
25 float filterstore;
26 float damp1;
27 float damp2;
28 float *buffer;
29 int bufsize;
30 int bufidx;
31};
32
33
34// Big to inline - but crucial for speed
35
36inline float comb::process(float input)
37{
38 float output;
39
40 output = buffer[bufidx];
41 undenormalise(output);
42
43 filterstore = (output*damp2) + (filterstore*damp1);
44 undenormalise(filterstore);
45
46 buffer[bufidx] = input + (filterstore*feedback);
47
48 if(++bufidx>=bufsize) bufidx = 0;
49
50 return output;
51}
52
53#endif //_comb_
54
55//ends
Definition comb.hpp:13