Commit 8400d104 authored by Laurent Aimar's avatar Laurent Aimar

Fixed undenormalise for 64 bits.

parent 4b00ff6e
...@@ -32,8 +32,7 @@ inline float allpass::process(float input) ...@@ -32,8 +32,7 @@ inline float allpass::process(float input)
float output; float output;
float bufout; float bufout;
bufout = buffer[bufidx]; bufout = undenormalise( buffer[bufidx] );
undenormalise(bufout);
output = -input + bufout; output = -input + bufout;
buffer[bufidx] = input + (bufout*feedback); buffer[bufidx] = input + (bufout*feedback);
......
...@@ -37,13 +37,11 @@ inline float comb::process(float input) ...@@ -37,13 +37,11 @@ inline float comb::process(float input)
{ {
float output; float output;
output = buffer[bufidx]; output = undenormalise( buffer[bufidx] );
undenormalise(output);
filterstore = (output*damp2) + (filterstore*damp1); filterstore = undenormalise( output*damp2 + filterstore*damp1 );
undenormalise(filterstore);
buffer[bufidx] = input + (filterstore*feedback); buffer[bufidx] = input + filterstore*feedback;
if(++bufidx>=bufsize) bufidx = 0; if(++bufidx>=bufsize) bufidx = 0;
......
...@@ -8,8 +8,16 @@ ...@@ -8,8 +8,16 @@
#ifndef _denormals_ #ifndef _denormals_
#define _denormals_ #define _denormals_
#define undenormalise(sample) if(((*(unsigned int*)&sample)&0x7f800000)==0) sample=0.0f #include <stdint.h>
static inline float undenormalise( float f )
{
union { float f; uint32_t u; } data;
data.f = f;
if( (data.u & 0x7f800000) == 0 )
return 0.0;
return f;
}
#endif//_denormals_ #endif//_denormals_
//ends
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment