From 8af756181545a92087a685a682fc5a40a91f2fbc Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 22 Jan 2017 20:18:59 -0500 Subject: [PATCH] audio: don't cast to double in SDL_ConvertStereoToMono(). It's expensive and (hopefully) unnecessary. If this becomes an overflow problem, we could multiply both values by 0.5f before adding them, but let's see if we can get by without the extra multiplication first. --HG-- extra : rebase_source : b7b47e961eb974510e133882548ea36b40f6d7e3 --- src/audio/SDL_audiocvt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index a922fd3e1..1c3d56a66 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -41,7 +41,7 @@ SDL_ConvertStereoToMono(SDL_AudioCVT * cvt, SDL_AudioFormat format) SDL_assert(format == AUDIO_F32SYS); for (i = cvt->len_cvt / 8; i; --i, src += 2) { - *(dst++) = (float) ((((double) src[0]) + ((double) src[1])) * 0.5); + *(dst++) = (src[0] + src[1]) * 0.5f; } cvt->len_cvt /= 2;