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

« « « Anklang Documentation
Loading...
Searching...
No Matches
allpass.hpp
Go to the documentation of this file.
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
7#ifndef _allpass_
8#define _allpass_
9#include "denormals.h"
10
12{
13public:
14 allpass();
15 void setbuffer(float *buf, int size);
16 inline float process(float inp);
17 void mute();
18 void setfeedback(float val);
19 float getfeedback();
20// private:
21 float feedback;
22 float *buffer;
23 int bufsize;
24 int bufidx;
25};
26
27
28// Big to inline - but crucial for speed
29
30inline float allpass::process(float input)
31{
32 float output;
33 float bufout;
34
35 bufout = buffer[bufidx];
36 undenormalise(bufout);
37
38 output = -input + bufout;
39 buffer[bufidx] = input + (bufout*feedback);
40
41 if(++bufidx>=bufsize) bufidx = 0;
42
43 return output;
44}
45
46#endif//_allpass
47
48//ends