Mercurial > sdl-ios-xcode
diff src/audio/SDL_mixer.c @ 2013:0615fa58c0be
Fixed S32 audio mixing, but I'm a bit nervous about the use of 64-bit
datatypes here...
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Fri, 01 Sep 2006 19:17:05 +0000 |
parents | 8055185ae4ed |
children | 7abe37467fa5 |
line wrap: on
line diff
--- a/src/audio/SDL_mixer.c Fri Sep 01 19:16:26 2006 +0000 +++ b/src/audio/SDL_mixer.c Fri Sep 01 19:17:05 2006 +0000 @@ -261,17 +261,17 @@ { const Uint32 *src32 = (Uint32 *) src; Uint32 *dst32 = (Uint32 *) dst; - Sint32 src1, src2; + Sint64 src1, src2; Sint64 dst_sample; const Sint64 max_audioval = ((((Sint64) 1) << (32 - 1)) - 1); const Sint64 min_audioval = -(((Sint64) 1) << (32 - 1)); len /= 4; while (len--) { - src1 = (Sint32) SDL_SwapLE32(*src32); + src1 = (Sint64) ((Sint32) SDL_SwapLE32(*src32)); src32++; ADJUST_VOLUME(src1, volume); - src2 = (Sint32) SDL_SwapLE32(*dst32); + src2 = (Sint64) ((Sint32) SDL_SwapLE32(*dst32)); dst_sample = src1 + src2; if (dst_sample > max_audioval) { dst_sample = max_audioval; @@ -287,17 +287,17 @@ { const Uint32 *src32 = (Uint32 *) src; Uint32 *dst32 = (Uint32 *) dst; - Sint32 src1, src2; + Sint64 src1, src2; Sint64 dst_sample; const Sint64 max_audioval = ((((Sint64) 1) << (32 - 1)) - 1); const Sint64 min_audioval = -(((Sint64) 1) << (32 - 1)); len /= 4; while (len--) { - src1 = (Sint32) SDL_SwapBE32(*src32); + src1 = (Sint64) ((Sint32) SDL_SwapBE32(*src32)); src32++; ADJUST_VOLUME(src1, volume); - src2 = (Sint32) SDL_SwapBE32(*dst32); + src2 = (Sint64) ((Sint32) SDL_SwapBE32(*dst32)); dst_sample = src1 + src2; if (dst_sample > max_audioval) { dst_sample = max_audioval;