src/audio/SDL_audiocvt.c
changeset 2760 02aa80d7905f
parent 2738 79c1bd651f04
child 2765 f55c87ae336b
     1.1 --- a/src/audio/SDL_audiocvt.c	Mon Sep 15 06:49:23 2008 +0000
     1.2 +++ b/src/audio/SDL_audiocvt.c	Mon Sep 15 07:34:36 2008 +0000
     1.3 @@ -29,6 +29,8 @@
     1.4  #include "SDL_audio.h"
     1.5  #include "SDL_audio_c.h"
     1.6  
     1.7 +#include "../libm/math.h"
     1.8 +
     1.9  //#define DEBUG_CONVERT
    1.10  
    1.11  /* These are fractional multiplication routines. That is, their inputs
    1.12 @@ -1352,6 +1354,7 @@
    1.13     For now, use RBJ's cookbook coefficients. It might be more
    1.14     optimal to create a Butterworth filter, but this is more difficult.
    1.15  */
    1.16 +#if 0
    1.17  int
    1.18  SDL_BuildIIRLowpass(SDL_AudioCVT * cvt, SDL_AudioFormat format)
    1.19  {
    1.20 @@ -1443,7 +1446,10 @@
    1.21      SDL_memset(cvt->state_buf, 0, 4 * SDL_AUDIO_BITSIZE(format) / 4);
    1.22      cvt->state_pos = 0;
    1.23  #undef convert_fixed
    1.24 +
    1.25 +	return 0;
    1.26  }
    1.27 +#endif
    1.28  
    1.29  /* Apply the lowpass IIR filter to the given SDL_AudioCVT struct */
    1.30  /* This was implemented because it would be much faster than the fir filter, 
    1.31 @@ -1667,7 +1673,7 @@
    1.32                  0.42f - 0.5f * cosf(two_pi_over_m * (float) i) +
    1.33                  0.08f * cosf(four_pi_over_m * (float) i);
    1.34          }
    1.35 -        norm_sum += fabs(fSinc[i]);
    1.36 +        norm_sum += fSinc[i] < 0 ? -fSinc[i] : fSinc[i]; /* fabs(fSinc[i]); */
    1.37      }
    1.38  
    1.39      norm_fact = 1.0f / norm_sum;