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)
float output;
float bufout;
bufout = buffer[bufidx];
undenormalise(bufout);
bufout = undenormalise( buffer[bufidx] );
output = -input + bufout;
buffer[bufidx] = input + (bufout*feedback);
......
......@@ -37,13 +37,11 @@ inline float comb::process(float input)
{
float output;
output = buffer[bufidx];
undenormalise(output);
output = undenormalise( buffer[bufidx] );
filterstore = (output*damp2) + (filterstore*damp1);
undenormalise(filterstore);
filterstore = undenormalise( output*damp2 + filterstore*damp1 );
buffer[bufidx] = input + (filterstore*feedback);
buffer[bufidx] = input + filterstore*feedback;
if(++bufidx>=bufsize) bufidx = 0;
......
......@@ -8,8 +8,16 @@
#ifndef _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_
//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