| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
#ifndef _allpass_ |
|---|
| 8 |
#define _allpass_ |
|---|
| 9 |
#include "denormals.h" |
|---|
| 10 |
|
|---|
| 11 |
class allpass |
|---|
| 12 |
{ |
|---|
| 13 |
public: |
|---|
| 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 |
|
|---|
| 21 |
float feedback; |
|---|
| 22 |
float *buffer; |
|---|
| 23 |
int bufsize; |
|---|
| 24 |
int bufidx; |
|---|
| 25 |
}; |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
inline float allpass::process(float input) |
|---|
| 31 |
{ |
|---|
| 32 |
float output; |
|---|
| 33 |
float bufout; |
|---|
| 34 |
|
|---|
| 35 |
bufout = undenormalise( buffer[bufidx] ); |
|---|
| 36 |
|
|---|
| 37 |
output = -input + bufout; |
|---|
| 38 |
buffer[bufidx] = input + (bufout*feedback); |
|---|
| 39 |
|
|---|
| 40 |
if(++bufidx>=bufsize) bufidx = 0; |
|---|
| 41 |
|
|---|
| 42 |
return output; |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|
| 45 |
#endif//_allpass |
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|