comparison src/audio/SDL_audiocvt.c @ 2765:f55c87ae336b

Final merge of Google Summer of Code 2008 work... Bring SDL to iPhone and iPod Touch by Holmes Futrell, mentored by Sam Lantinga
author Sam Lantinga <slouken@libsdl.org>
date Sat, 04 Oct 2008 06:46:59 +0000
parents 02aa80d7905f
children 26861c61142a
comparison
equal deleted inserted replaced
2764:4868c0df2e83 2765:f55c87ae336b
1445 /* Initialize the state buffer to all zeroes, and set initial position */ 1445 /* Initialize the state buffer to all zeroes, and set initial position */
1446 SDL_memset(cvt->state_buf, 0, 4 * SDL_AUDIO_BITSIZE(format) / 4); 1446 SDL_memset(cvt->state_buf, 0, 4 * SDL_AUDIO_BITSIZE(format) / 4);
1447 cvt->state_pos = 0; 1447 cvt->state_pos = 0;
1448 #undef convert_fixed 1448 #undef convert_fixed
1449 1449
1450 return 0; 1450 return 0;
1451 } 1451 }
1452 #endif 1452 #endif
1453 1453
1454 /* Apply the lowpass IIR filter to the given SDL_AudioCVT struct */ 1454 /* Apply the lowpass IIR filter to the given SDL_AudioCVT struct */
1455 /* This was implemented because it would be much faster than the fir filter, 1455 /* This was implemented because it would be much faster than the fir filter,
1671 /* Apply blackman window */ 1671 /* Apply blackman window */
1672 fSinc[i] *= 1672 fSinc[i] *=
1673 0.42f - 0.5f * cosf(two_pi_over_m * (float) i) + 1673 0.42f - 0.5f * cosf(two_pi_over_m * (float) i) +
1674 0.08f * cosf(four_pi_over_m * (float) i); 1674 0.08f * cosf(four_pi_over_m * (float) i);
1675 } 1675 }
1676 norm_sum += fSinc[i] < 0 ? -fSinc[i] : fSinc[i]; /* fabs(fSinc[i]); */ 1676 norm_sum += fSinc[i] < 0 ? -fSinc[i] : fSinc[i]; /* fabs(fSinc[i]); */
1677 } 1677 }
1678 1678
1679 norm_fact = 1.0f / norm_sum; 1679 norm_fact = 1.0f / norm_sum;
1680 1680
1681 #define convert_fixed(type, fix) { \ 1681 #define convert_fixed(type, fix) { \