root/modules/audio_filter/spatializer/allpass.hpp

Revision 8400d104d4236612af4b31ea1852383dcfe31c7f, 0.8 kB (checked in by Laurent Aimar <fenrir@videolan.org>, 5 months ago)

Fixed undenormalise for 64 bits.

  • Property mode set to 100644
Line 
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
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 // 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
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 //ends
48
Note: See TracBrowser for help on using the browser.