comparison src/audio/SDL_audiotypecvt.c @ 2955:2692999d5271

Avoid unnecessary assignment in generated audio type converters.
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 02 Jan 2009 07:34:01 +0000
parents 99210400e8b9
children 1210d5a28e16
comparison
equal deleted inserted replaced
2954:2c01dc6218cc 2955:2692999d5271
47 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) { 47 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) {
48 const Sint8 val = ((*src) ^ 0x80); 48 const Sint8 val = ((*src) ^ 0x80);
49 *dst = ((Sint8) val); 49 *dst = ((Sint8) val);
50 } 50 }
51 51
52 format = AUDIO_S8; 52 if (cvt->filters[++cvt->filter_index]) {
53 if (cvt->filters[++cvt->filter_index]) { 53 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
54 cvt->filters[cvt->filter_index] (cvt, format);
55 } 54 }
56 } 55 }
57 56
58 static void SDLCALL 57 static void SDLCALL
59 SDL_Convert_U8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 58 SDL_Convert_U8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
72 const Uint16 val = (((Uint16) *src) << 8); 71 const Uint16 val = (((Uint16) *src) << 8);
73 *dst = SDL_SwapLE16(val); 72 *dst = SDL_SwapLE16(val);
74 } 73 }
75 74
76 cvt->len_cvt *= 2; 75 cvt->len_cvt *= 2;
77 format = AUDIO_U16LSB; 76 if (cvt->filters[++cvt->filter_index]) {
78 if (cvt->filters[++cvt->filter_index]) { 77 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
79 cvt->filters[cvt->filter_index] (cvt, format);
80 } 78 }
81 } 79 }
82 80
83 static void SDLCALL 81 static void SDLCALL
84 SDL_Convert_U8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 82 SDL_Convert_U8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
97 const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8); 95 const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8);
98 *dst = ((Sint16) SDL_SwapLE16(val)); 96 *dst = ((Sint16) SDL_SwapLE16(val));
99 } 97 }
100 98
101 cvt->len_cvt *= 2; 99 cvt->len_cvt *= 2;
102 format = AUDIO_S16LSB; 100 if (cvt->filters[++cvt->filter_index]) {
103 if (cvt->filters[++cvt->filter_index]) { 101 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
104 cvt->filters[cvt->filter_index] (cvt, format);
105 } 102 }
106 } 103 }
107 104
108 static void SDLCALL 105 static void SDLCALL
109 SDL_Convert_U8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 106 SDL_Convert_U8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
122 const Uint16 val = (((Uint16) *src) << 8); 119 const Uint16 val = (((Uint16) *src) << 8);
123 *dst = SDL_SwapBE16(val); 120 *dst = SDL_SwapBE16(val);
124 } 121 }
125 122
126 cvt->len_cvt *= 2; 123 cvt->len_cvt *= 2;
127 format = AUDIO_U16MSB; 124 if (cvt->filters[++cvt->filter_index]) {
128 if (cvt->filters[++cvt->filter_index]) { 125 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
129 cvt->filters[cvt->filter_index] (cvt, format);
130 } 126 }
131 } 127 }
132 128
133 static void SDLCALL 129 static void SDLCALL
134 SDL_Convert_U8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 130 SDL_Convert_U8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
147 const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8); 143 const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8);
148 *dst = ((Sint16) SDL_SwapBE16(val)); 144 *dst = ((Sint16) SDL_SwapBE16(val));
149 } 145 }
150 146
151 cvt->len_cvt *= 2; 147 cvt->len_cvt *= 2;
152 format = AUDIO_S16MSB; 148 if (cvt->filters[++cvt->filter_index]) {
153 if (cvt->filters[++cvt->filter_index]) { 149 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
154 cvt->filters[cvt->filter_index] (cvt, format);
155 } 150 }
156 } 151 }
157 152
158 static void SDLCALL 153 static void SDLCALL
159 SDL_Convert_U8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 154 SDL_Convert_U8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
172 const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24); 167 const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24);
173 *dst = ((Sint32) SDL_SwapLE32(val)); 168 *dst = ((Sint32) SDL_SwapLE32(val));
174 } 169 }
175 170
176 cvt->len_cvt *= 4; 171 cvt->len_cvt *= 4;
177 format = AUDIO_S32LSB; 172 if (cvt->filters[++cvt->filter_index]) {
178 if (cvt->filters[++cvt->filter_index]) { 173 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
179 cvt->filters[cvt->filter_index] (cvt, format);
180 } 174 }
181 } 175 }
182 176
183 static void SDLCALL 177 static void SDLCALL
184 SDL_Convert_U8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 178 SDL_Convert_U8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
197 const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24); 191 const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24);
198 *dst = ((Sint32) SDL_SwapBE32(val)); 192 *dst = ((Sint32) SDL_SwapBE32(val));
199 } 193 }
200 194
201 cvt->len_cvt *= 4; 195 cvt->len_cvt *= 4;
202 format = AUDIO_S32MSB; 196 if (cvt->filters[++cvt->filter_index]) {
203 if (cvt->filters[++cvt->filter_index]) { 197 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
204 cvt->filters[cvt->filter_index] (cvt, format);
205 } 198 }
206 } 199 }
207 200
208 static void SDLCALL 201 static void SDLCALL
209 SDL_Convert_U8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 202 SDL_Convert_U8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
222 const float val = ((((float) *src) * DIVBY127) - 1.0f); 215 const float val = ((((float) *src) * DIVBY127) - 1.0f);
223 *dst = SDL_SwapFloatLE(val); 216 *dst = SDL_SwapFloatLE(val);
224 } 217 }
225 218
226 cvt->len_cvt *= 4; 219 cvt->len_cvt *= 4;
227 format = AUDIO_F32LSB; 220 if (cvt->filters[++cvt->filter_index]) {
228 if (cvt->filters[++cvt->filter_index]) { 221 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
229 cvt->filters[cvt->filter_index] (cvt, format);
230 } 222 }
231 } 223 }
232 224
233 static void SDLCALL 225 static void SDLCALL
234 SDL_Convert_U8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 226 SDL_Convert_U8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
247 const float val = ((((float) *src) * DIVBY127) - 1.0f); 239 const float val = ((((float) *src) * DIVBY127) - 1.0f);
248 *dst = SDL_SwapFloatBE(val); 240 *dst = SDL_SwapFloatBE(val);
249 } 241 }
250 242
251 cvt->len_cvt *= 4; 243 cvt->len_cvt *= 4;
252 format = AUDIO_F32MSB; 244 if (cvt->filters[++cvt->filter_index]) {
253 if (cvt->filters[++cvt->filter_index]) { 245 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
254 cvt->filters[cvt->filter_index] (cvt, format);
255 } 246 }
256 } 247 }
257 248
258 static void SDLCALL 249 static void SDLCALL
259 SDL_Convert_S8_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 250 SDL_Convert_S8_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
271 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) { 262 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) {
272 const Uint8 val = ((((Sint8) *src)) ^ 0x80); 263 const Uint8 val = ((((Sint8) *src)) ^ 0x80);
273 *dst = val; 264 *dst = val;
274 } 265 }
275 266
276 format = AUDIO_U8; 267 if (cvt->filters[++cvt->filter_index]) {
277 if (cvt->filters[++cvt->filter_index]) { 268 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
278 cvt->filters[cvt->filter_index] (cvt, format);
279 } 269 }
280 } 270 }
281 271
282 static void SDLCALL 272 static void SDLCALL
283 SDL_Convert_S8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 273 SDL_Convert_S8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
296 const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8); 286 const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8);
297 *dst = SDL_SwapLE16(val); 287 *dst = SDL_SwapLE16(val);
298 } 288 }
299 289
300 cvt->len_cvt *= 2; 290 cvt->len_cvt *= 2;
301 format = AUDIO_U16LSB; 291 if (cvt->filters[++cvt->filter_index]) {
302 if (cvt->filters[++cvt->filter_index]) { 292 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
303 cvt->filters[cvt->filter_index] (cvt, format);
304 } 293 }
305 } 294 }
306 295
307 static void SDLCALL 296 static void SDLCALL
308 SDL_Convert_S8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 297 SDL_Convert_S8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
321 const Sint16 val = (((Sint16) ((Sint8) *src)) << 8); 310 const Sint16 val = (((Sint16) ((Sint8) *src)) << 8);
322 *dst = ((Sint16) SDL_SwapLE16(val)); 311 *dst = ((Sint16) SDL_SwapLE16(val));
323 } 312 }
324 313
325 cvt->len_cvt *= 2; 314 cvt->len_cvt *= 2;
326 format = AUDIO_S16LSB; 315 if (cvt->filters[++cvt->filter_index]) {
327 if (cvt->filters[++cvt->filter_index]) { 316 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
328 cvt->filters[cvt->filter_index] (cvt, format);
329 } 317 }
330 } 318 }
331 319
332 static void SDLCALL 320 static void SDLCALL
333 SDL_Convert_S8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 321 SDL_Convert_S8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
346 const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8); 334 const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8);
347 *dst = SDL_SwapBE16(val); 335 *dst = SDL_SwapBE16(val);
348 } 336 }
349 337
350 cvt->len_cvt *= 2; 338 cvt->len_cvt *= 2;
351 format = AUDIO_U16MSB; 339 if (cvt->filters[++cvt->filter_index]) {
352 if (cvt->filters[++cvt->filter_index]) { 340 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
353 cvt->filters[cvt->filter_index] (cvt, format);
354 } 341 }
355 } 342 }
356 343
357 static void SDLCALL 344 static void SDLCALL
358 SDL_Convert_S8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 345 SDL_Convert_S8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
371 const Sint16 val = (((Sint16) ((Sint8) *src)) << 8); 358 const Sint16 val = (((Sint16) ((Sint8) *src)) << 8);
372 *dst = ((Sint16) SDL_SwapBE16(val)); 359 *dst = ((Sint16) SDL_SwapBE16(val));
373 } 360 }
374 361
375 cvt->len_cvt *= 2; 362 cvt->len_cvt *= 2;
376 format = AUDIO_S16MSB; 363 if (cvt->filters[++cvt->filter_index]) {
377 if (cvt->filters[++cvt->filter_index]) { 364 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
378 cvt->filters[cvt->filter_index] (cvt, format);
379 } 365 }
380 } 366 }
381 367
382 static void SDLCALL 368 static void SDLCALL
383 SDL_Convert_S8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 369 SDL_Convert_S8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
396 const Sint32 val = (((Sint32) ((Sint8) *src)) << 24); 382 const Sint32 val = (((Sint32) ((Sint8) *src)) << 24);
397 *dst = ((Sint32) SDL_SwapLE32(val)); 383 *dst = ((Sint32) SDL_SwapLE32(val));
398 } 384 }
399 385
400 cvt->len_cvt *= 4; 386 cvt->len_cvt *= 4;
401 format = AUDIO_S32LSB; 387 if (cvt->filters[++cvt->filter_index]) {
402 if (cvt->filters[++cvt->filter_index]) { 388 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
403 cvt->filters[cvt->filter_index] (cvt, format);
404 } 389 }
405 } 390 }
406 391
407 static void SDLCALL 392 static void SDLCALL
408 SDL_Convert_S8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 393 SDL_Convert_S8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
421 const Sint32 val = (((Sint32) ((Sint8) *src)) << 24); 406 const Sint32 val = (((Sint32) ((Sint8) *src)) << 24);
422 *dst = ((Sint32) SDL_SwapBE32(val)); 407 *dst = ((Sint32) SDL_SwapBE32(val));
423 } 408 }
424 409
425 cvt->len_cvt *= 4; 410 cvt->len_cvt *= 4;
426 format = AUDIO_S32MSB; 411 if (cvt->filters[++cvt->filter_index]) {
427 if (cvt->filters[++cvt->filter_index]) { 412 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
428 cvt->filters[cvt->filter_index] (cvt, format);
429 } 413 }
430 } 414 }
431 415
432 static void SDLCALL 416 static void SDLCALL
433 SDL_Convert_S8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 417 SDL_Convert_S8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
446 const float val = (((float) ((Sint8) *src)) * DIVBY127); 430 const float val = (((float) ((Sint8) *src)) * DIVBY127);
447 *dst = SDL_SwapFloatLE(val); 431 *dst = SDL_SwapFloatLE(val);
448 } 432 }
449 433
450 cvt->len_cvt *= 4; 434 cvt->len_cvt *= 4;
451 format = AUDIO_F32LSB; 435 if (cvt->filters[++cvt->filter_index]) {
452 if (cvt->filters[++cvt->filter_index]) { 436 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
453 cvt->filters[cvt->filter_index] (cvt, format);
454 } 437 }
455 } 438 }
456 439
457 static void SDLCALL 440 static void SDLCALL
458 SDL_Convert_S8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 441 SDL_Convert_S8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
471 const float val = (((float) ((Sint8) *src)) * DIVBY127); 454 const float val = (((float) ((Sint8) *src)) * DIVBY127);
472 *dst = SDL_SwapFloatBE(val); 455 *dst = SDL_SwapFloatBE(val);
473 } 456 }
474 457
475 cvt->len_cvt *= 4; 458 cvt->len_cvt *= 4;
476 format = AUDIO_F32MSB; 459 if (cvt->filters[++cvt->filter_index]) {
477 if (cvt->filters[++cvt->filter_index]) { 460 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
478 cvt->filters[cvt->filter_index] (cvt, format);
479 } 461 }
480 } 462 }
481 463
482 static void SDLCALL 464 static void SDLCALL
483 SDL_Convert_U16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 465 SDL_Convert_U16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
496 const Uint8 val = ((Uint8) (SDL_SwapLE16(*src) >> 8)); 478 const Uint8 val = ((Uint8) (SDL_SwapLE16(*src) >> 8));
497 *dst = val; 479 *dst = val;
498 } 480 }
499 481
500 cvt->len_cvt /= 2; 482 cvt->len_cvt /= 2;
501 format = AUDIO_U8; 483 if (cvt->filters[++cvt->filter_index]) {
502 if (cvt->filters[++cvt->filter_index]) { 484 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
503 cvt->filters[cvt->filter_index] (cvt, format);
504 } 485 }
505 } 486 }
506 487
507 static void SDLCALL 488 static void SDLCALL
508 SDL_Convert_U16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 489 SDL_Convert_U16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
521 const Sint8 val = ((Sint8) (((SDL_SwapLE16(*src)) ^ 0x8000) >> 8)); 502 const Sint8 val = ((Sint8) (((SDL_SwapLE16(*src)) ^ 0x8000) >> 8));
522 *dst = ((Sint8) val); 503 *dst = ((Sint8) val);
523 } 504 }
524 505
525 cvt->len_cvt /= 2; 506 cvt->len_cvt /= 2;
526 format = AUDIO_S8; 507 if (cvt->filters[++cvt->filter_index]) {
527 if (cvt->filters[++cvt->filter_index]) { 508 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
528 cvt->filters[cvt->filter_index] (cvt, format);
529 } 509 }
530 } 510 }
531 511
532 static void SDLCALL 512 static void SDLCALL
533 SDL_Convert_U16LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 513 SDL_Convert_U16LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
545 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { 525 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
546 const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000); 526 const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000);
547 *dst = ((Sint16) SDL_SwapLE16(val)); 527 *dst = ((Sint16) SDL_SwapLE16(val));
548 } 528 }
549 529
550 format = AUDIO_S16LSB; 530 if (cvt->filters[++cvt->filter_index]) {
551 if (cvt->filters[++cvt->filter_index]) { 531 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
552 cvt->filters[cvt->filter_index] (cvt, format);
553 } 532 }
554 } 533 }
555 534
556 static void SDLCALL 535 static void SDLCALL
557 SDL_Convert_U16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 536 SDL_Convert_U16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
569 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { 548 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
570 const Uint16 val = SDL_SwapLE16(*src); 549 const Uint16 val = SDL_SwapLE16(*src);
571 *dst = SDL_SwapBE16(val); 550 *dst = SDL_SwapBE16(val);
572 } 551 }
573 552
574 format = AUDIO_U16MSB; 553 if (cvt->filters[++cvt->filter_index]) {
575 if (cvt->filters[++cvt->filter_index]) { 554 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
576 cvt->filters[cvt->filter_index] (cvt, format);
577 } 555 }
578 } 556 }
579 557
580 static void SDLCALL 558 static void SDLCALL
581 SDL_Convert_U16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 559 SDL_Convert_U16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
593 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { 571 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
594 const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000); 572 const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000);
595 *dst = ((Sint16) SDL_SwapBE16(val)); 573 *dst = ((Sint16) SDL_SwapBE16(val));
596 } 574 }
597 575
598 format = AUDIO_S16MSB; 576 if (cvt->filters[++cvt->filter_index]) {
599 if (cvt->filters[++cvt->filter_index]) { 577 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
600 cvt->filters[cvt->filter_index] (cvt, format);
601 } 578 }
602 } 579 }
603 580
604 static void SDLCALL 581 static void SDLCALL
605 SDL_Convert_U16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 582 SDL_Convert_U16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
618 const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16); 595 const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16);
619 *dst = ((Sint32) SDL_SwapLE32(val)); 596 *dst = ((Sint32) SDL_SwapLE32(val));
620 } 597 }
621 598
622 cvt->len_cvt *= 2; 599 cvt->len_cvt *= 2;
623 format = AUDIO_S32LSB; 600 if (cvt->filters[++cvt->filter_index]) {
624 if (cvt->filters[++cvt->filter_index]) { 601 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
625 cvt->filters[cvt->filter_index] (cvt, format);
626 } 602 }
627 } 603 }
628 604
629 static void SDLCALL 605 static void SDLCALL
630 SDL_Convert_U16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 606 SDL_Convert_U16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
643 const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16); 619 const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16);
644 *dst = ((Sint32) SDL_SwapBE32(val)); 620 *dst = ((Sint32) SDL_SwapBE32(val));
645 } 621 }
646 622
647 cvt->len_cvt *= 2; 623 cvt->len_cvt *= 2;
648 format = AUDIO_S32MSB; 624 if (cvt->filters[++cvt->filter_index]) {
649 if (cvt->filters[++cvt->filter_index]) { 625 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
650 cvt->filters[cvt->filter_index] (cvt, format);
651 } 626 }
652 } 627 }
653 628
654 static void SDLCALL 629 static void SDLCALL
655 SDL_Convert_U16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 630 SDL_Convert_U16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
668 const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f); 643 const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f);
669 *dst = SDL_SwapFloatLE(val); 644 *dst = SDL_SwapFloatLE(val);
670 } 645 }
671 646
672 cvt->len_cvt *= 2; 647 cvt->len_cvt *= 2;
673 format = AUDIO_F32LSB; 648 if (cvt->filters[++cvt->filter_index]) {
674 if (cvt->filters[++cvt->filter_index]) { 649 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
675 cvt->filters[cvt->filter_index] (cvt, format);
676 } 650 }
677 } 651 }
678 652
679 static void SDLCALL 653 static void SDLCALL
680 SDL_Convert_U16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 654 SDL_Convert_U16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
693 const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f); 667 const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f);
694 *dst = SDL_SwapFloatBE(val); 668 *dst = SDL_SwapFloatBE(val);
695 } 669 }
696 670
697 cvt->len_cvt *= 2; 671 cvt->len_cvt *= 2;
698 format = AUDIO_F32MSB; 672 if (cvt->filters[++cvt->filter_index]) {
699 if (cvt->filters[++cvt->filter_index]) { 673 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
700 cvt->filters[cvt->filter_index] (cvt, format);
701 } 674 }
702 } 675 }
703 676
704 static void SDLCALL 677 static void SDLCALL
705 SDL_Convert_S16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 678 SDL_Convert_S16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
718 const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000) >> 8)); 691 const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000) >> 8));
719 *dst = val; 692 *dst = val;
720 } 693 }
721 694
722 cvt->len_cvt /= 2; 695 cvt->len_cvt /= 2;
723 format = AUDIO_U8; 696 if (cvt->filters[++cvt->filter_index]) {
724 if (cvt->filters[++cvt->filter_index]) { 697 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
725 cvt->filters[cvt->filter_index] (cvt, format);
726 } 698 }
727 } 699 }
728 700
729 static void SDLCALL 701 static void SDLCALL
730 SDL_Convert_S16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 702 SDL_Convert_S16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
743 const Sint8 val = ((Sint8) (((Sint16) SDL_SwapLE16(*src)) >> 8)); 715 const Sint8 val = ((Sint8) (((Sint16) SDL_SwapLE16(*src)) >> 8));
744 *dst = ((Sint8) val); 716 *dst = ((Sint8) val);
745 } 717 }
746 718
747 cvt->len_cvt /= 2; 719 cvt->len_cvt /= 2;
748 format = AUDIO_S8; 720 if (cvt->filters[++cvt->filter_index]) {
749 if (cvt->filters[++cvt->filter_index]) { 721 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
750 cvt->filters[cvt->filter_index] (cvt, format);
751 } 722 }
752 } 723 }
753 724
754 static void SDLCALL 725 static void SDLCALL
755 SDL_Convert_S16LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 726 SDL_Convert_S16LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
767 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { 738 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
768 const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000); 739 const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000);
769 *dst = SDL_SwapLE16(val); 740 *dst = SDL_SwapLE16(val);
770 } 741 }
771 742
772 format = AUDIO_U16LSB; 743 if (cvt->filters[++cvt->filter_index]) {
773 if (cvt->filters[++cvt->filter_index]) { 744 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
774 cvt->filters[cvt->filter_index] (cvt, format);
775 } 745 }
776 } 746 }
777 747
778 static void SDLCALL 748 static void SDLCALL
779 SDL_Convert_S16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 749 SDL_Convert_S16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
791 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { 761 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
792 const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000); 762 const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000);
793 *dst = SDL_SwapBE16(val); 763 *dst = SDL_SwapBE16(val);
794 } 764 }
795 765
796 format = AUDIO_U16MSB; 766 if (cvt->filters[++cvt->filter_index]) {
797 if (cvt->filters[++cvt->filter_index]) { 767 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
798 cvt->filters[cvt->filter_index] (cvt, format);
799 } 768 }
800 } 769 }
801 770
802 static void SDLCALL 771 static void SDLCALL
803 SDL_Convert_S16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 772 SDL_Convert_S16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
815 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { 784 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
816 const Sint16 val = ((Sint16) SDL_SwapLE16(*src)); 785 const Sint16 val = ((Sint16) SDL_SwapLE16(*src));
817 *dst = ((Sint16) SDL_SwapBE16(val)); 786 *dst = ((Sint16) SDL_SwapBE16(val));
818 } 787 }
819 788
820 format = AUDIO_S16MSB; 789 if (cvt->filters[++cvt->filter_index]) {
821 if (cvt->filters[++cvt->filter_index]) { 790 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
822 cvt->filters[cvt->filter_index] (cvt, format);
823 } 791 }
824 } 792 }
825 793
826 static void SDLCALL 794 static void SDLCALL
827 SDL_Convert_S16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 795 SDL_Convert_S16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
840 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16); 808 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16);
841 *dst = ((Sint32) SDL_SwapLE32(val)); 809 *dst = ((Sint32) SDL_SwapLE32(val));
842 } 810 }
843 811
844 cvt->len_cvt *= 2; 812 cvt->len_cvt *= 2;
845 format = AUDIO_S32LSB; 813 if (cvt->filters[++cvt->filter_index]) {
846 if (cvt->filters[++cvt->filter_index]) { 814 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
847 cvt->filters[cvt->filter_index] (cvt, format);
848 } 815 }
849 } 816 }
850 817
851 static void SDLCALL 818 static void SDLCALL
852 SDL_Convert_S16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 819 SDL_Convert_S16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
865 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16); 832 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16);
866 *dst = ((Sint32) SDL_SwapBE32(val)); 833 *dst = ((Sint32) SDL_SwapBE32(val));
867 } 834 }
868 835
869 cvt->len_cvt *= 2; 836 cvt->len_cvt *= 2;
870 format = AUDIO_S32MSB; 837 if (cvt->filters[++cvt->filter_index]) {
871 if (cvt->filters[++cvt->filter_index]) { 838 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
872 cvt->filters[cvt->filter_index] (cvt, format);
873 } 839 }
874 } 840 }
875 841
876 static void SDLCALL 842 static void SDLCALL
877 SDL_Convert_S16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 843 SDL_Convert_S16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
890 const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767); 856 const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767);
891 *dst = SDL_SwapFloatLE(val); 857 *dst = SDL_SwapFloatLE(val);
892 } 858 }
893 859
894 cvt->len_cvt *= 2; 860 cvt->len_cvt *= 2;
895 format = AUDIO_F32LSB; 861 if (cvt->filters[++cvt->filter_index]) {
896 if (cvt->filters[++cvt->filter_index]) { 862 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
897 cvt->filters[cvt->filter_index] (cvt, format);
898 } 863 }
899 } 864 }
900 865
901 static void SDLCALL 866 static void SDLCALL
902 SDL_Convert_S16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 867 SDL_Convert_S16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
915 const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767); 880 const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767);
916 *dst = SDL_SwapFloatBE(val); 881 *dst = SDL_SwapFloatBE(val);
917 } 882 }
918 883
919 cvt->len_cvt *= 2; 884 cvt->len_cvt *= 2;
920 format = AUDIO_F32MSB; 885 if (cvt->filters[++cvt->filter_index]) {
921 if (cvt->filters[++cvt->filter_index]) { 886 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
922 cvt->filters[cvt->filter_index] (cvt, format);
923 } 887 }
924 } 888 }
925 889
926 static void SDLCALL 890 static void SDLCALL
927 SDL_Convert_U16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 891 SDL_Convert_U16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
940 const Uint8 val = ((Uint8) (SDL_SwapBE16(*src) >> 8)); 904 const Uint8 val = ((Uint8) (SDL_SwapBE16(*src) >> 8));
941 *dst = val; 905 *dst = val;
942 } 906 }
943 907
944 cvt->len_cvt /= 2; 908 cvt->len_cvt /= 2;
945 format = AUDIO_U8; 909 if (cvt->filters[++cvt->filter_index]) {
946 if (cvt->filters[++cvt->filter_index]) { 910 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
947 cvt->filters[cvt->filter_index] (cvt, format);
948 } 911 }
949 } 912 }
950 913
951 static void SDLCALL 914 static void SDLCALL
952 SDL_Convert_U16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 915 SDL_Convert_U16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
965 const Sint8 val = ((Sint8) (((SDL_SwapBE16(*src)) ^ 0x8000) >> 8)); 928 const Sint8 val = ((Sint8) (((SDL_SwapBE16(*src)) ^ 0x8000) >> 8));
966 *dst = ((Sint8) val); 929 *dst = ((Sint8) val);
967 } 930 }
968 931
969 cvt->len_cvt /= 2; 932 cvt->len_cvt /= 2;
970 format = AUDIO_S8; 933 if (cvt->filters[++cvt->filter_index]) {
971 if (cvt->filters[++cvt->filter_index]) { 934 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
972 cvt->filters[cvt->filter_index] (cvt, format);
973 } 935 }
974 } 936 }
975 937
976 static void SDLCALL 938 static void SDLCALL
977 SDL_Convert_U16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 939 SDL_Convert_U16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
989 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { 951 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
990 const Uint16 val = SDL_SwapBE16(*src); 952 const Uint16 val = SDL_SwapBE16(*src);
991 *dst = SDL_SwapLE16(val); 953 *dst = SDL_SwapLE16(val);
992 } 954 }
993 955
994 format = AUDIO_U16LSB; 956 if (cvt->filters[++cvt->filter_index]) {
995 if (cvt->filters[++cvt->filter_index]) { 957 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
996 cvt->filters[cvt->filter_index] (cvt, format);
997 } 958 }
998 } 959 }
999 960
1000 static void SDLCALL 961 static void SDLCALL
1001 SDL_Convert_U16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 962 SDL_Convert_U16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1013 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { 974 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1014 const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000); 975 const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000);
1015 *dst = ((Sint16) SDL_SwapLE16(val)); 976 *dst = ((Sint16) SDL_SwapLE16(val));
1016 } 977 }
1017 978
1018 format = AUDIO_S16LSB; 979 if (cvt->filters[++cvt->filter_index]) {
1019 if (cvt->filters[++cvt->filter_index]) { 980 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
1020 cvt->filters[cvt->filter_index] (cvt, format);
1021 } 981 }
1022 } 982 }
1023 983
1024 static void SDLCALL 984 static void SDLCALL
1025 SDL_Convert_U16MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 985 SDL_Convert_U16MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1037 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { 997 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1038 const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000); 998 const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000);
1039 *dst = ((Sint16) SDL_SwapBE16(val)); 999 *dst = ((Sint16) SDL_SwapBE16(val));
1040 } 1000 }
1041 1001
1042 format = AUDIO_S16MSB; 1002 if (cvt->filters[++cvt->filter_index]) {
1043 if (cvt->filters[++cvt->filter_index]) { 1003 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
1044 cvt->filters[cvt->filter_index] (cvt, format);
1045 } 1004 }
1046 } 1005 }
1047 1006
1048 static void SDLCALL 1007 static void SDLCALL
1049 SDL_Convert_U16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1008 SDL_Convert_U16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1062 const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16); 1021 const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16);
1063 *dst = ((Sint32) SDL_SwapLE32(val)); 1022 *dst = ((Sint32) SDL_SwapLE32(val));
1064 } 1023 }
1065 1024
1066 cvt->len_cvt *= 2; 1025 cvt->len_cvt *= 2;
1067 format = AUDIO_S32LSB; 1026 if (cvt->filters[++cvt->filter_index]) {
1068 if (cvt->filters[++cvt->filter_index]) { 1027 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
1069 cvt->filters[cvt->filter_index] (cvt, format);
1070 } 1028 }
1071 } 1029 }
1072 1030
1073 static void SDLCALL 1031 static void SDLCALL
1074 SDL_Convert_U16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1032 SDL_Convert_U16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1087 const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16); 1045 const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16);
1088 *dst = ((Sint32) SDL_SwapBE32(val)); 1046 *dst = ((Sint32) SDL_SwapBE32(val));
1089 } 1047 }
1090 1048
1091 cvt->len_cvt *= 2; 1049 cvt->len_cvt *= 2;
1092 format = AUDIO_S32MSB; 1050 if (cvt->filters[++cvt->filter_index]) {
1093 if (cvt->filters[++cvt->filter_index]) { 1051 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
1094 cvt->filters[cvt->filter_index] (cvt, format);
1095 } 1052 }
1096 } 1053 }
1097 1054
1098 static void SDLCALL 1055 static void SDLCALL
1099 SDL_Convert_U16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1056 SDL_Convert_U16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1112 const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f); 1069 const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f);
1113 *dst = SDL_SwapFloatLE(val); 1070 *dst = SDL_SwapFloatLE(val);
1114 } 1071 }
1115 1072
1116 cvt->len_cvt *= 2; 1073 cvt->len_cvt *= 2;
1117 format = AUDIO_F32LSB; 1074 if (cvt->filters[++cvt->filter_index]) {
1118 if (cvt->filters[++cvt->filter_index]) { 1075 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
1119 cvt->filters[cvt->filter_index] (cvt, format);
1120 } 1076 }
1121 } 1077 }
1122 1078
1123 static void SDLCALL 1079 static void SDLCALL
1124 SDL_Convert_U16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1080 SDL_Convert_U16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1137 const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f); 1093 const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f);
1138 *dst = SDL_SwapFloatBE(val); 1094 *dst = SDL_SwapFloatBE(val);
1139 } 1095 }
1140 1096
1141 cvt->len_cvt *= 2; 1097 cvt->len_cvt *= 2;
1142 format = AUDIO_F32MSB; 1098 if (cvt->filters[++cvt->filter_index]) {
1143 if (cvt->filters[++cvt->filter_index]) { 1099 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
1144 cvt->filters[cvt->filter_index] (cvt, format);
1145 } 1100 }
1146 } 1101 }
1147 1102
1148 static void SDLCALL 1103 static void SDLCALL
1149 SDL_Convert_S16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1104 SDL_Convert_S16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1162 const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000) >> 8)); 1117 const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000) >> 8));
1163 *dst = val; 1118 *dst = val;
1164 } 1119 }
1165 1120
1166 cvt->len_cvt /= 2; 1121 cvt->len_cvt /= 2;
1167 format = AUDIO_U8; 1122 if (cvt->filters[++cvt->filter_index]) {
1168 if (cvt->filters[++cvt->filter_index]) { 1123 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
1169 cvt->filters[cvt->filter_index] (cvt, format);
1170 } 1124 }
1171 } 1125 }
1172 1126
1173 static void SDLCALL 1127 static void SDLCALL
1174 SDL_Convert_S16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1128 SDL_Convert_S16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1187 const Sint8 val = ((Sint8) (((Sint16) SDL_SwapBE16(*src)) >> 8)); 1141 const Sint8 val = ((Sint8) (((Sint16) SDL_SwapBE16(*src)) >> 8));
1188 *dst = ((Sint8) val); 1142 *dst = ((Sint8) val);
1189 } 1143 }
1190 1144
1191 cvt->len_cvt /= 2; 1145 cvt->len_cvt /= 2;
1192 format = AUDIO_S8; 1146 if (cvt->filters[++cvt->filter_index]) {
1193 if (cvt->filters[++cvt->filter_index]) { 1147 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
1194 cvt->filters[cvt->filter_index] (cvt, format);
1195 } 1148 }
1196 } 1149 }
1197 1150
1198 static void SDLCALL 1151 static void SDLCALL
1199 SDL_Convert_S16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1152 SDL_Convert_S16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1211 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { 1164 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1212 const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000); 1165 const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000);
1213 *dst = SDL_SwapLE16(val); 1166 *dst = SDL_SwapLE16(val);
1214 } 1167 }
1215 1168
1216 format = AUDIO_U16LSB; 1169 if (cvt->filters[++cvt->filter_index]) {
1217 if (cvt->filters[++cvt->filter_index]) { 1170 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
1218 cvt->filters[cvt->filter_index] (cvt, format);
1219 } 1171 }
1220 } 1172 }
1221 1173
1222 static void SDLCALL 1174 static void SDLCALL
1223 SDL_Convert_S16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1175 SDL_Convert_S16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1235 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { 1187 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1236 const Sint16 val = ((Sint16) SDL_SwapBE16(*src)); 1188 const Sint16 val = ((Sint16) SDL_SwapBE16(*src));
1237 *dst = ((Sint16) SDL_SwapLE16(val)); 1189 *dst = ((Sint16) SDL_SwapLE16(val));
1238 } 1190 }
1239 1191
1240 format = AUDIO_S16LSB; 1192 if (cvt->filters[++cvt->filter_index]) {
1241 if (cvt->filters[++cvt->filter_index]) { 1193 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
1242 cvt->filters[cvt->filter_index] (cvt, format);
1243 } 1194 }
1244 } 1195 }
1245 1196
1246 static void SDLCALL 1197 static void SDLCALL
1247 SDL_Convert_S16MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1198 SDL_Convert_S16MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1259 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { 1210 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1260 const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000); 1211 const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000);
1261 *dst = SDL_SwapBE16(val); 1212 *dst = SDL_SwapBE16(val);
1262 } 1213 }
1263 1214
1264 format = AUDIO_U16MSB; 1215 if (cvt->filters[++cvt->filter_index]) {
1265 if (cvt->filters[++cvt->filter_index]) { 1216 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
1266 cvt->filters[cvt->filter_index] (cvt, format);
1267 } 1217 }
1268 } 1218 }
1269 1219
1270 static void SDLCALL 1220 static void SDLCALL
1271 SDL_Convert_S16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1221 SDL_Convert_S16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1284 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16); 1234 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16);
1285 *dst = ((Sint32) SDL_SwapLE32(val)); 1235 *dst = ((Sint32) SDL_SwapLE32(val));
1286 } 1236 }
1287 1237
1288 cvt->len_cvt *= 2; 1238 cvt->len_cvt *= 2;
1289 format = AUDIO_S32LSB; 1239 if (cvt->filters[++cvt->filter_index]) {
1290 if (cvt->filters[++cvt->filter_index]) { 1240 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
1291 cvt->filters[cvt->filter_index] (cvt, format);
1292 } 1241 }
1293 } 1242 }
1294 1243
1295 static void SDLCALL 1244 static void SDLCALL
1296 SDL_Convert_S16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1245 SDL_Convert_S16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1309 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16); 1258 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16);
1310 *dst = ((Sint32) SDL_SwapBE32(val)); 1259 *dst = ((Sint32) SDL_SwapBE32(val));
1311 } 1260 }
1312 1261
1313 cvt->len_cvt *= 2; 1262 cvt->len_cvt *= 2;
1314 format = AUDIO_S32MSB; 1263 if (cvt->filters[++cvt->filter_index]) {
1315 if (cvt->filters[++cvt->filter_index]) { 1264 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
1316 cvt->filters[cvt->filter_index] (cvt, format);
1317 } 1265 }
1318 } 1266 }
1319 1267
1320 static void SDLCALL 1268 static void SDLCALL
1321 SDL_Convert_S16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1269 SDL_Convert_S16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1334 const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767); 1282 const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767);
1335 *dst = SDL_SwapFloatLE(val); 1283 *dst = SDL_SwapFloatLE(val);
1336 } 1284 }
1337 1285
1338 cvt->len_cvt *= 2; 1286 cvt->len_cvt *= 2;
1339 format = AUDIO_F32LSB; 1287 if (cvt->filters[++cvt->filter_index]) {
1340 if (cvt->filters[++cvt->filter_index]) { 1288 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
1341 cvt->filters[cvt->filter_index] (cvt, format);
1342 } 1289 }
1343 } 1290 }
1344 1291
1345 static void SDLCALL 1292 static void SDLCALL
1346 SDL_Convert_S16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1293 SDL_Convert_S16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1359 const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767); 1306 const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767);
1360 *dst = SDL_SwapFloatBE(val); 1307 *dst = SDL_SwapFloatBE(val);
1361 } 1308 }
1362 1309
1363 cvt->len_cvt *= 2; 1310 cvt->len_cvt *= 2;
1364 format = AUDIO_F32MSB; 1311 if (cvt->filters[++cvt->filter_index]) {
1365 if (cvt->filters[++cvt->filter_index]) { 1312 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
1366 cvt->filters[cvt->filter_index] (cvt, format);
1367 } 1313 }
1368 } 1314 }
1369 1315
1370 static void SDLCALL 1316 static void SDLCALL
1371 SDL_Convert_S32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1317 SDL_Convert_S32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1384 const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 24)); 1330 const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 24));
1385 *dst = val; 1331 *dst = val;
1386 } 1332 }
1387 1333
1388 cvt->len_cvt /= 4; 1334 cvt->len_cvt /= 4;
1389 format = AUDIO_U8; 1335 if (cvt->filters[++cvt->filter_index]) {
1390 if (cvt->filters[++cvt->filter_index]) { 1336 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
1391 cvt->filters[cvt->filter_index] (cvt, format);
1392 } 1337 }
1393 } 1338 }
1394 1339
1395 static void SDLCALL 1340 static void SDLCALL
1396 SDL_Convert_S32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1341 SDL_Convert_S32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1409 const Sint8 val = ((Sint8) (((Sint32) SDL_SwapLE32(*src)) >> 24)); 1354 const Sint8 val = ((Sint8) (((Sint32) SDL_SwapLE32(*src)) >> 24));
1410 *dst = ((Sint8) val); 1355 *dst = ((Sint8) val);
1411 } 1356 }
1412 1357
1413 cvt->len_cvt /= 4; 1358 cvt->len_cvt /= 4;
1414 format = AUDIO_S8; 1359 if (cvt->filters[++cvt->filter_index]) {
1415 if (cvt->filters[++cvt->filter_index]) { 1360 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
1416 cvt->filters[cvt->filter_index] (cvt, format);
1417 } 1361 }
1418 } 1362 }
1419 1363
1420 static void SDLCALL 1364 static void SDLCALL
1421 SDL_Convert_S32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1365 SDL_Convert_S32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1434 const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16)); 1378 const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16));
1435 *dst = SDL_SwapLE16(val); 1379 *dst = SDL_SwapLE16(val);
1436 } 1380 }
1437 1381
1438 cvt->len_cvt /= 2; 1382 cvt->len_cvt /= 2;
1439 format = AUDIO_U16LSB; 1383 if (cvt->filters[++cvt->filter_index]) {
1440 if (cvt->filters[++cvt->filter_index]) { 1384 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
1441 cvt->filters[cvt->filter_index] (cvt, format);
1442 } 1385 }
1443 } 1386 }
1444 1387
1445 static void SDLCALL 1388 static void SDLCALL
1446 SDL_Convert_S32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1389 SDL_Convert_S32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1459 const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16)); 1402 const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16));
1460 *dst = ((Sint16) SDL_SwapLE16(val)); 1403 *dst = ((Sint16) SDL_SwapLE16(val));
1461 } 1404 }
1462 1405
1463 cvt->len_cvt /= 2; 1406 cvt->len_cvt /= 2;
1464 format = AUDIO_S16LSB; 1407 if (cvt->filters[++cvt->filter_index]) {
1465 if (cvt->filters[++cvt->filter_index]) { 1408 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
1466 cvt->filters[cvt->filter_index] (cvt, format);
1467 } 1409 }
1468 } 1410 }
1469 1411
1470 static void SDLCALL 1412 static void SDLCALL
1471 SDL_Convert_S32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1413 SDL_Convert_S32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1484 const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16)); 1426 const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16));
1485 *dst = SDL_SwapBE16(val); 1427 *dst = SDL_SwapBE16(val);
1486 } 1428 }
1487 1429
1488 cvt->len_cvt /= 2; 1430 cvt->len_cvt /= 2;
1489 format = AUDIO_U16MSB; 1431 if (cvt->filters[++cvt->filter_index]) {
1490 if (cvt->filters[++cvt->filter_index]) { 1432 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
1491 cvt->filters[cvt->filter_index] (cvt, format);
1492 } 1433 }
1493 } 1434 }
1494 1435
1495 static void SDLCALL 1436 static void SDLCALL
1496 SDL_Convert_S32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1437 SDL_Convert_S32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1509 const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16)); 1450 const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16));
1510 *dst = ((Sint16) SDL_SwapBE16(val)); 1451 *dst = ((Sint16) SDL_SwapBE16(val));
1511 } 1452 }
1512 1453
1513 cvt->len_cvt /= 2; 1454 cvt->len_cvt /= 2;
1514 format = AUDIO_S16MSB; 1455 if (cvt->filters[++cvt->filter_index]) {
1515 if (cvt->filters[++cvt->filter_index]) { 1456 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
1516 cvt->filters[cvt->filter_index] (cvt, format);
1517 } 1457 }
1518 } 1458 }
1519 1459
1520 static void SDLCALL 1460 static void SDLCALL
1521 SDL_Convert_S32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1461 SDL_Convert_S32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1533 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { 1473 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1534 const Sint32 val = ((Sint32) SDL_SwapLE32(*src)); 1474 const Sint32 val = ((Sint32) SDL_SwapLE32(*src));
1535 *dst = ((Sint32) SDL_SwapBE32(val)); 1475 *dst = ((Sint32) SDL_SwapBE32(val));
1536 } 1476 }
1537 1477
1538 format = AUDIO_S32MSB; 1478 if (cvt->filters[++cvt->filter_index]) {
1539 if (cvt->filters[++cvt->filter_index]) { 1479 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
1540 cvt->filters[cvt->filter_index] (cvt, format);
1541 } 1480 }
1542 } 1481 }
1543 1482
1544 static void SDLCALL 1483 static void SDLCALL
1545 SDL_Convert_S32LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1484 SDL_Convert_S32LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1557 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { 1496 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1558 const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647); 1497 const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647);
1559 *dst = SDL_SwapFloatLE(val); 1498 *dst = SDL_SwapFloatLE(val);
1560 } 1499 }
1561 1500
1562 format = AUDIO_F32LSB; 1501 if (cvt->filters[++cvt->filter_index]) {
1563 if (cvt->filters[++cvt->filter_index]) { 1502 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
1564 cvt->filters[cvt->filter_index] (cvt, format);
1565 } 1503 }
1566 } 1504 }
1567 1505
1568 static void SDLCALL 1506 static void SDLCALL
1569 SDL_Convert_S32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1507 SDL_Convert_S32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1581 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { 1519 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1582 const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647); 1520 const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647);
1583 *dst = SDL_SwapFloatBE(val); 1521 *dst = SDL_SwapFloatBE(val);
1584 } 1522 }
1585 1523
1586 format = AUDIO_F32MSB; 1524 if (cvt->filters[++cvt->filter_index]) {
1587 if (cvt->filters[++cvt->filter_index]) { 1525 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
1588 cvt->filters[cvt->filter_index] (cvt, format);
1589 } 1526 }
1590 } 1527 }
1591 1528
1592 static void SDLCALL 1529 static void SDLCALL
1593 SDL_Convert_S32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1530 SDL_Convert_S32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1606 const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 24)); 1543 const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 24));
1607 *dst = val; 1544 *dst = val;
1608 } 1545 }
1609 1546
1610 cvt->len_cvt /= 4; 1547 cvt->len_cvt /= 4;
1611 format = AUDIO_U8; 1548 if (cvt->filters[++cvt->filter_index]) {
1612 if (cvt->filters[++cvt->filter_index]) { 1549 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
1613 cvt->filters[cvt->filter_index] (cvt, format);
1614 } 1550 }
1615 } 1551 }
1616 1552
1617 static void SDLCALL 1553 static void SDLCALL
1618 SDL_Convert_S32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1554 SDL_Convert_S32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1631 const Sint8 val = ((Sint8) (((Sint32) SDL_SwapBE32(*src)) >> 24)); 1567 const Sint8 val = ((Sint8) (((Sint32) SDL_SwapBE32(*src)) >> 24));
1632 *dst = ((Sint8) val); 1568 *dst = ((Sint8) val);
1633 } 1569 }
1634 1570
1635 cvt->len_cvt /= 4; 1571 cvt->len_cvt /= 4;
1636 format = AUDIO_S8; 1572 if (cvt->filters[++cvt->filter_index]) {
1637 if (cvt->filters[++cvt->filter_index]) { 1573 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
1638 cvt->filters[cvt->filter_index] (cvt, format);
1639 } 1574 }
1640 } 1575 }
1641 1576
1642 static void SDLCALL 1577 static void SDLCALL
1643 SDL_Convert_S32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1578 SDL_Convert_S32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1656 const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16)); 1591 const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16));
1657 *dst = SDL_SwapLE16(val); 1592 *dst = SDL_SwapLE16(val);
1658 } 1593 }
1659 1594
1660 cvt->len_cvt /= 2; 1595 cvt->len_cvt /= 2;
1661 format = AUDIO_U16LSB; 1596 if (cvt->filters[++cvt->filter_index]) {
1662 if (cvt->filters[++cvt->filter_index]) { 1597 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
1663 cvt->filters[cvt->filter_index] (cvt, format);
1664 } 1598 }
1665 } 1599 }
1666 1600
1667 static void SDLCALL 1601 static void SDLCALL
1668 SDL_Convert_S32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1602 SDL_Convert_S32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1681 const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16)); 1615 const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16));
1682 *dst = ((Sint16) SDL_SwapLE16(val)); 1616 *dst = ((Sint16) SDL_SwapLE16(val));
1683 } 1617 }
1684 1618
1685 cvt->len_cvt /= 2; 1619 cvt->len_cvt /= 2;
1686 format = AUDIO_S16LSB; 1620 if (cvt->filters[++cvt->filter_index]) {
1687 if (cvt->filters[++cvt->filter_index]) { 1621 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
1688 cvt->filters[cvt->filter_index] (cvt, format);
1689 } 1622 }
1690 } 1623 }
1691 1624
1692 static void SDLCALL 1625 static void SDLCALL
1693 SDL_Convert_S32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1626 SDL_Convert_S32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1706 const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16)); 1639 const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16));
1707 *dst = SDL_SwapBE16(val); 1640 *dst = SDL_SwapBE16(val);
1708 } 1641 }
1709 1642
1710 cvt->len_cvt /= 2; 1643 cvt->len_cvt /= 2;
1711 format = AUDIO_U16MSB; 1644 if (cvt->filters[++cvt->filter_index]) {
1712 if (cvt->filters[++cvt->filter_index]) { 1645 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
1713 cvt->filters[cvt->filter_index] (cvt, format);
1714 } 1646 }
1715 } 1647 }
1716 1648
1717 static void SDLCALL 1649 static void SDLCALL
1718 SDL_Convert_S32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1650 SDL_Convert_S32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1731 const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16)); 1663 const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16));
1732 *dst = ((Sint16) SDL_SwapBE16(val)); 1664 *dst = ((Sint16) SDL_SwapBE16(val));
1733 } 1665 }
1734 1666
1735 cvt->len_cvt /= 2; 1667 cvt->len_cvt /= 2;
1736 format = AUDIO_S16MSB; 1668 if (cvt->filters[++cvt->filter_index]) {
1737 if (cvt->filters[++cvt->filter_index]) { 1669 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
1738 cvt->filters[cvt->filter_index] (cvt, format);
1739 } 1670 }
1740 } 1671 }
1741 1672
1742 static void SDLCALL 1673 static void SDLCALL
1743 SDL_Convert_S32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1674 SDL_Convert_S32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1755 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { 1686 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1756 const Sint32 val = ((Sint32) SDL_SwapBE32(*src)); 1687 const Sint32 val = ((Sint32) SDL_SwapBE32(*src));
1757 *dst = ((Sint32) SDL_SwapLE32(val)); 1688 *dst = ((Sint32) SDL_SwapLE32(val));
1758 } 1689 }
1759 1690
1760 format = AUDIO_S32LSB; 1691 if (cvt->filters[++cvt->filter_index]) {
1761 if (cvt->filters[++cvt->filter_index]) { 1692 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
1762 cvt->filters[cvt->filter_index] (cvt, format);
1763 } 1693 }
1764 } 1694 }
1765 1695
1766 static void SDLCALL 1696 static void SDLCALL
1767 SDL_Convert_S32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1697 SDL_Convert_S32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1779 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { 1709 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1780 const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647); 1710 const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647);
1781 *dst = SDL_SwapFloatLE(val); 1711 *dst = SDL_SwapFloatLE(val);
1782 } 1712 }
1783 1713
1784 format = AUDIO_F32LSB; 1714 if (cvt->filters[++cvt->filter_index]) {
1785 if (cvt->filters[++cvt->filter_index]) { 1715 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
1786 cvt->filters[cvt->filter_index] (cvt, format);
1787 } 1716 }
1788 } 1717 }
1789 1718
1790 static void SDLCALL 1719 static void SDLCALL
1791 SDL_Convert_S32MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1720 SDL_Convert_S32MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1803 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { 1732 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1804 const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647); 1733 const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647);
1805 *dst = SDL_SwapFloatBE(val); 1734 *dst = SDL_SwapFloatBE(val);
1806 } 1735 }
1807 1736
1808 format = AUDIO_F32MSB; 1737 if (cvt->filters[++cvt->filter_index]) {
1809 if (cvt->filters[++cvt->filter_index]) { 1738 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
1810 cvt->filters[cvt->filter_index] (cvt, format);
1811 } 1739 }
1812 } 1740 }
1813 1741
1814 static void SDLCALL 1742 static void SDLCALL
1815 SDL_Convert_F32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1743 SDL_Convert_F32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1828 const Uint8 val = ((Uint8) ((SDL_SwapFloatLE(*src) + 1.0f) * 127.0f)); 1756 const Uint8 val = ((Uint8) ((SDL_SwapFloatLE(*src) + 1.0f) * 127.0f));
1829 *dst = val; 1757 *dst = val;
1830 } 1758 }
1831 1759
1832 cvt->len_cvt /= 4; 1760 cvt->len_cvt /= 4;
1833 format = AUDIO_U8; 1761 if (cvt->filters[++cvt->filter_index]) {
1834 if (cvt->filters[++cvt->filter_index]) { 1762 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
1835 cvt->filters[cvt->filter_index] (cvt, format);
1836 } 1763 }
1837 } 1764 }
1838 1765
1839 static void SDLCALL 1766 static void SDLCALL
1840 SDL_Convert_F32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1767 SDL_Convert_F32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1853 const Sint8 val = ((Sint8) (SDL_SwapFloatLE(*src) * 127.0f)); 1780 const Sint8 val = ((Sint8) (SDL_SwapFloatLE(*src) * 127.0f));
1854 *dst = ((Sint8) val); 1781 *dst = ((Sint8) val);
1855 } 1782 }
1856 1783
1857 cvt->len_cvt /= 4; 1784 cvt->len_cvt /= 4;
1858 format = AUDIO_S8; 1785 if (cvt->filters[++cvt->filter_index]) {
1859 if (cvt->filters[++cvt->filter_index]) { 1786 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
1860 cvt->filters[cvt->filter_index] (cvt, format);
1861 } 1787 }
1862 } 1788 }
1863 1789
1864 static void SDLCALL 1790 static void SDLCALL
1865 SDL_Convert_F32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1791 SDL_Convert_F32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1878 const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f)); 1804 const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f));
1879 *dst = SDL_SwapLE16(val); 1805 *dst = SDL_SwapLE16(val);
1880 } 1806 }
1881 1807
1882 cvt->len_cvt /= 2; 1808 cvt->len_cvt /= 2;
1883 format = AUDIO_U16LSB; 1809 if (cvt->filters[++cvt->filter_index]) {
1884 if (cvt->filters[++cvt->filter_index]) { 1810 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
1885 cvt->filters[cvt->filter_index] (cvt, format);
1886 } 1811 }
1887 } 1812 }
1888 1813
1889 static void SDLCALL 1814 static void SDLCALL
1890 SDL_Convert_F32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1815 SDL_Convert_F32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1903 const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f)); 1828 const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f));
1904 *dst = ((Sint16) SDL_SwapLE16(val)); 1829 *dst = ((Sint16) SDL_SwapLE16(val));
1905 } 1830 }
1906 1831
1907 cvt->len_cvt /= 2; 1832 cvt->len_cvt /= 2;
1908 format = AUDIO_S16LSB; 1833 if (cvt->filters[++cvt->filter_index]) {
1909 if (cvt->filters[++cvt->filter_index]) { 1834 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
1910 cvt->filters[cvt->filter_index] (cvt, format);
1911 } 1835 }
1912 } 1836 }
1913 1837
1914 static void SDLCALL 1838 static void SDLCALL
1915 SDL_Convert_F32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1839 SDL_Convert_F32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1928 const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f)); 1852 const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f));
1929 *dst = SDL_SwapBE16(val); 1853 *dst = SDL_SwapBE16(val);
1930 } 1854 }
1931 1855
1932 cvt->len_cvt /= 2; 1856 cvt->len_cvt /= 2;
1933 format = AUDIO_U16MSB; 1857 if (cvt->filters[++cvt->filter_index]) {
1934 if (cvt->filters[++cvt->filter_index]) { 1858 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
1935 cvt->filters[cvt->filter_index] (cvt, format);
1936 } 1859 }
1937 } 1860 }
1938 1861
1939 static void SDLCALL 1862 static void SDLCALL
1940 SDL_Convert_F32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1863 SDL_Convert_F32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1953 const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f)); 1876 const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f));
1954 *dst = ((Sint16) SDL_SwapBE16(val)); 1877 *dst = ((Sint16) SDL_SwapBE16(val));
1955 } 1878 }
1956 1879
1957 cvt->len_cvt /= 2; 1880 cvt->len_cvt /= 2;
1958 format = AUDIO_S16MSB; 1881 if (cvt->filters[++cvt->filter_index]) {
1959 if (cvt->filters[++cvt->filter_index]) { 1882 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
1960 cvt->filters[cvt->filter_index] (cvt, format);
1961 } 1883 }
1962 } 1884 }
1963 1885
1964 static void SDLCALL 1886 static void SDLCALL
1965 SDL_Convert_F32LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1887 SDL_Convert_F32LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1977 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { 1899 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1978 const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0)); 1900 const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0));
1979 *dst = ((Sint32) SDL_SwapLE32(val)); 1901 *dst = ((Sint32) SDL_SwapLE32(val));
1980 } 1902 }
1981 1903
1982 format = AUDIO_S32LSB; 1904 if (cvt->filters[++cvt->filter_index]) {
1983 if (cvt->filters[++cvt->filter_index]) { 1905 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
1984 cvt->filters[cvt->filter_index] (cvt, format);
1985 } 1906 }
1986 } 1907 }
1987 1908
1988 static void SDLCALL 1909 static void SDLCALL
1989 SDL_Convert_F32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1910 SDL_Convert_F32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2001 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { 1922 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2002 const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0)); 1923 const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0));
2003 *dst = ((Sint32) SDL_SwapBE32(val)); 1924 *dst = ((Sint32) SDL_SwapBE32(val));
2004 } 1925 }
2005 1926
2006 format = AUDIO_S32MSB; 1927 if (cvt->filters[++cvt->filter_index]) {
2007 if (cvt->filters[++cvt->filter_index]) { 1928 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
2008 cvt->filters[cvt->filter_index] (cvt, format);
2009 } 1929 }
2010 } 1930 }
2011 1931
2012 static void SDLCALL 1932 static void SDLCALL
2013 SDL_Convert_F32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1933 SDL_Convert_F32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2025 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { 1945 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2026 const float val = SDL_SwapFloatLE(*src); 1946 const float val = SDL_SwapFloatLE(*src);
2027 *dst = SDL_SwapFloatBE(val); 1947 *dst = SDL_SwapFloatBE(val);
2028 } 1948 }
2029 1949
2030 format = AUDIO_F32MSB; 1950 if (cvt->filters[++cvt->filter_index]) {
2031 if (cvt->filters[++cvt->filter_index]) { 1951 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB);
2032 cvt->filters[cvt->filter_index] (cvt, format);
2033 } 1952 }
2034 } 1953 }
2035 1954
2036 static void SDLCALL 1955 static void SDLCALL
2037 SDL_Convert_F32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1956 SDL_Convert_F32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2050 const Uint8 val = ((Uint8) ((SDL_SwapFloatBE(*src) + 1.0f) * 127.0f)); 1969 const Uint8 val = ((Uint8) ((SDL_SwapFloatBE(*src) + 1.0f) * 127.0f));
2051 *dst = val; 1970 *dst = val;
2052 } 1971 }
2053 1972
2054 cvt->len_cvt /= 4; 1973 cvt->len_cvt /= 4;
2055 format = AUDIO_U8; 1974 if (cvt->filters[++cvt->filter_index]) {
2056 if (cvt->filters[++cvt->filter_index]) { 1975 cvt->filters[cvt->filter_index] (cvt, AUDIO_U8);
2057 cvt->filters[cvt->filter_index] (cvt, format);
2058 } 1976 }
2059 } 1977 }
2060 1978
2061 static void SDLCALL 1979 static void SDLCALL
2062 SDL_Convert_F32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) 1980 SDL_Convert_F32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2075 const Sint8 val = ((Sint8) (SDL_SwapFloatBE(*src) * 127.0f)); 1993 const Sint8 val = ((Sint8) (SDL_SwapFloatBE(*src) * 127.0f));
2076 *dst = ((Sint8) val); 1994 *dst = ((Sint8) val);
2077 } 1995 }
2078 1996
2079 cvt->len_cvt /= 4; 1997 cvt->len_cvt /= 4;
2080 format = AUDIO_S8; 1998 if (cvt->filters[++cvt->filter_index]) {
2081 if (cvt->filters[++cvt->filter_index]) { 1999 cvt->filters[cvt->filter_index] (cvt, AUDIO_S8);
2082 cvt->filters[cvt->filter_index] (cvt, format);
2083 } 2000 }
2084 } 2001 }
2085 2002
2086 static void SDLCALL 2003 static void SDLCALL
2087 SDL_Convert_F32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 2004 SDL_Convert_F32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2100 const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f)); 2017 const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f));
2101 *dst = SDL_SwapLE16(val); 2018 *dst = SDL_SwapLE16(val);
2102 } 2019 }
2103 2020
2104 cvt->len_cvt /= 2; 2021 cvt->len_cvt /= 2;
2105 format = AUDIO_U16LSB; 2022 if (cvt->filters[++cvt->filter_index]) {
2106 if (cvt->filters[++cvt->filter_index]) { 2023 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB);
2107 cvt->filters[cvt->filter_index] (cvt, format);
2108 } 2024 }
2109 } 2025 }
2110 2026
2111 static void SDLCALL 2027 static void SDLCALL
2112 SDL_Convert_F32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 2028 SDL_Convert_F32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2125 const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f)); 2041 const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f));
2126 *dst = ((Sint16) SDL_SwapLE16(val)); 2042 *dst = ((Sint16) SDL_SwapLE16(val));
2127 } 2043 }
2128 2044
2129 cvt->len_cvt /= 2; 2045 cvt->len_cvt /= 2;
2130 format = AUDIO_S16LSB; 2046 if (cvt->filters[++cvt->filter_index]) {
2131 if (cvt->filters[++cvt->filter_index]) { 2047 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB);
2132 cvt->filters[cvt->filter_index] (cvt, format);
2133 } 2048 }
2134 } 2049 }
2135 2050
2136 static void SDLCALL 2051 static void SDLCALL
2137 SDL_Convert_F32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 2052 SDL_Convert_F32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2150 const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f)); 2065 const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f));
2151 *dst = SDL_SwapBE16(val); 2066 *dst = SDL_SwapBE16(val);
2152 } 2067 }
2153 2068
2154 cvt->len_cvt /= 2; 2069 cvt->len_cvt /= 2;
2155 format = AUDIO_U16MSB; 2070 if (cvt->filters[++cvt->filter_index]) {
2156 if (cvt->filters[++cvt->filter_index]) { 2071 cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB);
2157 cvt->filters[cvt->filter_index] (cvt, format);
2158 } 2072 }
2159 } 2073 }
2160 2074
2161 static void SDLCALL 2075 static void SDLCALL
2162 SDL_Convert_F32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 2076 SDL_Convert_F32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2175 const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f)); 2089 const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f));
2176 *dst = ((Sint16) SDL_SwapBE16(val)); 2090 *dst = ((Sint16) SDL_SwapBE16(val));
2177 } 2091 }
2178 2092
2179 cvt->len_cvt /= 2; 2093 cvt->len_cvt /= 2;
2180 format = AUDIO_S16MSB; 2094 if (cvt->filters[++cvt->filter_index]) {
2181 if (cvt->filters[++cvt->filter_index]) { 2095 cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB);
2182 cvt->filters[cvt->filter_index] (cvt, format);
2183 } 2096 }
2184 } 2097 }
2185 2098
2186 static void SDLCALL 2099 static void SDLCALL
2187 SDL_Convert_F32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 2100 SDL_Convert_F32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2199 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { 2112 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2200 const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0)); 2113 const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0));
2201 *dst = ((Sint32) SDL_SwapLE32(val)); 2114 *dst = ((Sint32) SDL_SwapLE32(val));
2202 } 2115 }
2203 2116
2204 format = AUDIO_S32LSB; 2117 if (cvt->filters[++cvt->filter_index]) {
2205 if (cvt->filters[++cvt->filter_index]) { 2118 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB);
2206 cvt->filters[cvt->filter_index] (cvt, format);
2207 } 2119 }
2208 } 2120 }
2209 2121
2210 static void SDLCALL 2122 static void SDLCALL
2211 SDL_Convert_F32MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 2123 SDL_Convert_F32MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2223 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { 2135 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2224 const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0)); 2136 const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0));
2225 *dst = ((Sint32) SDL_SwapBE32(val)); 2137 *dst = ((Sint32) SDL_SwapBE32(val));
2226 } 2138 }
2227 2139
2228 format = AUDIO_S32MSB; 2140 if (cvt->filters[++cvt->filter_index]) {
2229 if (cvt->filters[++cvt->filter_index]) { 2141 cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB);
2230 cvt->filters[cvt->filter_index] (cvt, format);
2231 } 2142 }
2232 } 2143 }
2233 2144
2234 static void SDLCALL 2145 static void SDLCALL
2235 SDL_Convert_F32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) 2146 SDL_Convert_F32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2247 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { 2158 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2248 const float val = SDL_SwapFloatBE(*src); 2159 const float val = SDL_SwapFloatBE(*src);
2249 *dst = SDL_SwapFloatLE(val); 2160 *dst = SDL_SwapFloatLE(val);
2250 } 2161 }
2251 2162
2252 format = AUDIO_F32LSB; 2163 if (cvt->filters[++cvt->filter_index]) {
2253 if (cvt->filters[++cvt->filter_index]) { 2164 cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB);
2254 cvt->filters[cvt->filter_index] (cvt, format);
2255 } 2165 }
2256 } 2166 }
2257 2167
2258 const SDL_AudioTypeFilters sdl_audio_type_filters[] = 2168 const SDL_AudioTypeFilters sdl_audio_type_filters[] =
2259 { 2169 {