Mercurial > sdl-ios-xcode
diff src/audio/SDL_audiocvt.c @ 3012:7e30c2dc7783
Fixed Visual C++ release build for Visual C++ 2005
* Some math functions become intrinsic in release mode, so we need to
convert all the math functions into SDL math functions, like we did
with the stdlib functions.
* Constant initializers of 8-bit values become calls to memset() in
release mode, but memset() itself is an intrinsic when explicitly
called. So we'll just explicitly call memset() in those cases.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 10 Jan 2009 18:32:24 +0000 |
parents | 11626a53e7bc |
children | f3dcf04412cf |
line wrap: on
line diff
--- a/src/audio/SDL_audiocvt.c Fri Jan 09 20:43:30 2009 +0000 +++ b/src/audio/SDL_audiocvt.c Sat Jan 10 18:32:24 2009 +0000 @@ -26,8 +26,6 @@ #include "SDL_audio.h" #include "SDL_audio_c.h" -#include "../libm/math.h" - //#define DEBUG_CONVERT /* These are fractional multiplication routines. That is, their inputs @@ -1658,13 +1656,9 @@ if (i == m / 2) { fSinc[i] = two_pi_fc; } else { - fSinc[i] = - sinf(two_pi_fc * ((float) i - m_over_two)) / ((float) i - - m_over_two); + fSinc[i] = SDL_sinf(two_pi_fc * ((float) i - m_over_two)) / ((float) i - m_over_two); /* Apply blackman window */ - fSinc[i] *= - 0.42f - 0.5f * cosf(two_pi_over_m * (float) i) + - 0.08f * cosf(four_pi_over_m * (float) i); + fSinc[i] *= 0.42f - 0.5f * SDL_cosf(two_pi_over_m * (float) i) + 0.08f * SDL_cosf(four_pi_over_m * (float) i); } norm_sum += fSinc[i] < 0 ? -fSinc[i] : fSinc[i]; /* fabs(fSinc[i]); */ } @@ -1740,7 +1734,7 @@ static void SDLCALL SDL_Resample(SDL_AudioCVT * cvt, SDL_AudioFormat format) { - int i, j; + int i; #ifdef DEBUG_CONVERT printf("Converting audio rate via proper resampling (mono)\n"); @@ -1752,8 +1746,8 @@ for (i = cvt->len / sizeof (type); i; --i) { \ src--; \ dst[-1] = src[0]; \ - for( j = -cvt->len_mult; j < -1; ++j ) { \ - dst[j] = 0; \ + if (cvt->len_mult > 1) { \ + SDL_memset(dst-cvt->len_mult, 0, cvt->len_mult-1); \ } \ dst -= cvt->len_mult; \ } \