|
Revision e991ef5da735eb35f4be38cc07d17c26bda398c4, 1.1 kB
(checked in by Geoffroy Couprie <geo.couprie@gmail.com>, 3 months ago)
|
Should remove the big white noise that was produced
|
- Property mode set to
100644
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
#ifndef _comb_ |
|---|
| 8 |
#define _comb_ |
|---|
| 9 |
|
|---|
| 10 |
#include "denormals.h" |
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
class comb |
|---|
| 17 |
{ |
|---|
| 18 |
public: |
|---|
| 19 |
comb(); |
|---|
| 20 |
void setbuffer(float *buf, int size); |
|---|
| 21 |
inline float process(float inp); |
|---|
| 22 |
void mute(); |
|---|
| 23 |
void setdamp(float val); |
|---|
| 24 |
float getdamp(); |
|---|
| 25 |
void setfeedback(float val); |
|---|
| 26 |
float getfeedback(); |
|---|
| 27 |
private: |
|---|
| 28 |
float feedback; |
|---|
| 29 |
float filterstore; |
|---|
| 30 |
float damp1; |
|---|
| 31 |
float damp2; |
|---|
| 32 |
float *buffer; |
|---|
| 33 |
int bufsize; |
|---|
| 34 |
int bufidx; |
|---|
| 35 |
}; |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
inline float comb::process(float input) |
|---|
| 41 |
{ |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
float output; |
|---|
| 46 |
|
|---|
| 47 |
output = undenormalise( buffer[bufidx] ); |
|---|
| 48 |
|
|---|
| 49 |
filterstore = undenormalise(output*damp2); |
|---|
| 50 |
|
|---|
| 51 |
buffer[bufidx] = input + filterstore*feedback; |
|---|
| 52 |
|
|---|
| 53 |
if(++bufidx>=bufsize) bufidx = 0; |
|---|
| 54 |
|
|---|
| 55 |
return output; |
|---|
| 56 |
} |
|---|
| 57 |
|
|---|
| 58 |
#endif //_comb_ |
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|