comparison src/audio/SDL_audiocvt.c @ 2049:5f6550e5184f

Merged SDL-ryan-multiple-audio-device branch r2803:2871 into the trunk.
author Ryan C. Gordon <icculus@icculus.org>
date Tue, 17 Oct 2006 09:15:21 +0000
parents 3908e1f808e1
children f932ac47a331
comparison
equal deleted inserted replaced
2048:6067c7f9a672 2049:5f6550e5184f
157 { 157 {
158 const float *src = (const float *) cvt->buf; 158 const float *src = (const float *) cvt->buf;
159 float *dst = (float *) cvt->buf; 159 float *dst = (float *) cvt->buf;
160 if (SDL_AUDIO_ISBIGENDIAN(format)) { 160 if (SDL_AUDIO_ISBIGENDIAN(format)) {
161 for (i = cvt->len_cvt / 8; i; --i, src += 2) { 161 for (i = cvt->len_cvt / 8; i; --i, src += 2) {
162 float src1, src2; 162 const float src1 = SDL_SwapFloatBE(src[0]);
163 src1 = SDL_SwapFloatBE(src[0]); 163 const float src2 = SDL_SwapFloatBE(src[1]);
164 src2 = SDL_SwapFloatBE(src[1]);
165 const double added = ((double) src1) + ((double) src2); 164 const double added = ((double) src1) + ((double) src2);
166 src1 = (float) (added * 0.5); 165 const float halved = (float) (added * 0.5);
167 *(dst++) = SDL_SwapFloatBE(src1); 166 *(dst++) = SDL_SwapFloatBE(halved);
168 } 167 }
169 } else { 168 } else {
170 for (i = cvt->len_cvt / 8; i; --i, src += 2) { 169 for (i = cvt->len_cvt / 8; i; --i, src += 2) {
171 float src1, src2; 170 const float src1 = SDL_SwapFloatLE(src[0]);
172 src1 = SDL_SwapFloatLE(src[0]); 171 const float src2 = SDL_SwapFloatLE(src[1]);
173 src2 = SDL_SwapFloatLE(src[1]);
174 const double added = ((double) src1) + ((double) src2); 172 const double added = ((double) src1) + ((double) src2);
175 src1 = (float) (added * 0.5); 173 const float halved = (float) (added * 0.5);
176 *(dst++) = SDL_SwapFloatLE(src1); 174 *(dst++) = SDL_SwapFloatLE(halved);
177 } 175 }
178 } 176 }
179 } 177 }
180 break; 178 break;
181 } 179 }