comparison src/audio/SDL_audiotypecvt.c @ 1982:3b4ce57c6215

First shot at new audio data types (int32 and float32). Notable changes: - Converters between types are autogenerated. Instead of making multiple passes over the data with seperate filters for endianess, size, signedness, etc, converting between data types is always one specialized filter. This simplifies SDL_BuildAudioCVT(), which otherwise had a million edge cases with the new types, and makes the actually conversions more CPU cache friendly. Left a stub for adding specific optimized versions of these routines (SSE/MMX/Altivec, assembler, etc) - Autogenerated converters are built by SDL/src/audio/sdlgenaudiocvt.pl. This does not need to be run unless tweaking the code, and thus doesn't need integration into the build system. - Went through all the drivers and tried to weed out all the "Uint16" references that are better specified with the new SDL_AudioFormat typedef. - Cleaned out a bunch of hardcoded bitwise magic numbers and replaced them with new SDL_AUDIO_* macros. - Added initial float32 and int32 support code. Theoretically, existing drivers will push these through converters to get the data they want to feed to the hardware. Still TODO: - Optimize and debug new converters. - Update the CoreAudio backend to accept float32 data directly. - Other backends, too? - SDL_LoadWAV() needs to be updated to support int32 and float32 .wav files (both of which exist and can be generated by 'sox' for testing purposes). - Update the mixer to handle new datatypes. - Optionally update SDL_sound and SDL_mixer, etc.
author Ryan C. Gordon <icculus@icculus.org>
date Thu, 24 Aug 2006 12:10:46 +0000
parents
children 8055185ae4ed
comparison
equal deleted inserted replaced
1981:3f21778e7433 1982:3b4ce57c6215
1 /* DO NOT EDIT THIS FILE! It is generated code. */
2 /* Please modify SDL/src/audio/sdlgenaudiocvt.pl instead. */
3
4 /*
5 SDL - Simple DirectMedia Layer
6 Copyright (C) 1997-2006 Sam Lantinga
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
22 Sam Lantinga
23 slouken@libsdl.org
24 */
25
26 #include "SDL_config.h"
27 #include "SDL_audio.h"
28 #include "SDL_audio_c.h"
29
30 /* Now the generated code... */
31
32 #define DIVBY127 0.0078740157480315f
33 #define DIVBY255 0.00392156862745098f
34 #define DIVBY32767 3.05185094759972e-05f
35 #define DIVBY65535 1.52590218966964e-05f
36 #define DIVBY2147483647 4.6566128752458e-10f
37
38 static void SDLCALL
39 SDL_Convert_U8_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
40 {
41 int i;
42 const Uint8 *src;
43 Sint8 *dst;
44
45 #ifdef DEBUG_CONVERT
46 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S8.\n");
47 #endif
48
49 src = (const Uint8 *) cvt->buf;
50 dst = (Sint8 *) cvt->buf;
51 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) {
52 const Sint8 val = ((*src) ^ 0x80);
53 *dst = ((Sint8) val);
54 }
55
56 format = AUDIO_S8;
57 if (cvt->filters[++cvt->filter_index]) {
58 cvt->filters[cvt->filter_index] (cvt, format);
59 }
60 }
61
62 static void SDLCALL
63 SDL_Convert_U8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
64 {
65 int i;
66 const Uint8 *src;
67 Uint16 *dst;
68
69 #ifdef DEBUG_CONVERT
70 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16LSB.\n");
71 #endif
72
73 src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
74 dst = (Uint16 *) (cvt->buf + cvt->len_cvt * 2);
75 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
76 const Uint16 val = (((Uint16) *src) << 8);
77 *dst = SDL_SwapLE16(val);
78 }
79
80 cvt->len_cvt *= 2;
81 format = AUDIO_U16LSB;
82 if (cvt->filters[++cvt->filter_index]) {
83 cvt->filters[cvt->filter_index] (cvt, format);
84 }
85 }
86
87 static void SDLCALL
88 SDL_Convert_U8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
89 {
90 int i;
91 const Uint8 *src;
92 Sint16 *dst;
93
94 #ifdef DEBUG_CONVERT
95 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16LSB.\n");
96 #endif
97
98 src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
99 dst = (Sint16 *) (cvt->buf + cvt->len_cvt * 2);
100 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
101 const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8);
102 *dst = ((Sint16) SDL_SwapLE16(val));
103 }
104
105 cvt->len_cvt *= 2;
106 format = AUDIO_S16LSB;
107 if (cvt->filters[++cvt->filter_index]) {
108 cvt->filters[cvt->filter_index] (cvt, format);
109 }
110 }
111
112 static void SDLCALL
113 SDL_Convert_U8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
114 {
115 int i;
116 const Uint8 *src;
117 Uint16 *dst;
118
119 #ifdef DEBUG_CONVERT
120 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16MSB.\n");
121 #endif
122
123 src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
124 dst = (Uint16 *) (cvt->buf + cvt->len_cvt * 2);
125 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
126 const Uint16 val = (((Uint16) *src) << 8);
127 *dst = SDL_SwapBE16(val);
128 }
129
130 cvt->len_cvt *= 2;
131 format = AUDIO_U16MSB;
132 if (cvt->filters[++cvt->filter_index]) {
133 cvt->filters[cvt->filter_index] (cvt, format);
134 }
135 }
136
137 static void SDLCALL
138 SDL_Convert_U8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
139 {
140 int i;
141 const Uint8 *src;
142 Sint16 *dst;
143
144 #ifdef DEBUG_CONVERT
145 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16MSB.\n");
146 #endif
147
148 src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
149 dst = (Sint16 *) (cvt->buf + cvt->len_cvt * 2);
150 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
151 const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8);
152 *dst = ((Sint16) SDL_SwapBE16(val));
153 }
154
155 cvt->len_cvt *= 2;
156 format = AUDIO_S16MSB;
157 if (cvt->filters[++cvt->filter_index]) {
158 cvt->filters[cvt->filter_index] (cvt, format);
159 }
160 }
161
162 static void SDLCALL
163 SDL_Convert_U8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
164 {
165 int i;
166 const Uint8 *src;
167 Sint32 *dst;
168
169 #ifdef DEBUG_CONVERT
170 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32LSB.\n");
171 #endif
172
173 src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
174 dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 4);
175 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
176 const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24);
177 *dst = ((Sint32) SDL_SwapLE32(val));
178 }
179
180 cvt->len_cvt *= 4;
181 format = AUDIO_S32LSB;
182 if (cvt->filters[++cvt->filter_index]) {
183 cvt->filters[cvt->filter_index] (cvt, format);
184 }
185 }
186
187 static void SDLCALL
188 SDL_Convert_U8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
189 {
190 int i;
191 const Uint8 *src;
192 Sint32 *dst;
193
194 #ifdef DEBUG_CONVERT
195 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32MSB.\n");
196 #endif
197
198 src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
199 dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 4);
200 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
201 const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24);
202 *dst = ((Sint32) SDL_SwapBE32(val));
203 }
204
205 cvt->len_cvt *= 4;
206 format = AUDIO_S32MSB;
207 if (cvt->filters[++cvt->filter_index]) {
208 cvt->filters[cvt->filter_index] (cvt, format);
209 }
210 }
211
212 static void SDLCALL
213 SDL_Convert_U8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
214 {
215 int i;
216 const Uint8 *src;
217 float *dst;
218
219 #ifdef DEBUG_CONVERT
220 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32LSB.\n");
221 #endif
222
223 src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
224 dst = (float *) (cvt->buf + cvt->len_cvt * 4);
225 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
226 const float val = (((float) *src) * DIVBY255);
227 *dst = SDL_SwapFloatLE(val);
228 }
229
230 cvt->len_cvt *= 4;
231 format = AUDIO_F32LSB;
232 if (cvt->filters[++cvt->filter_index]) {
233 cvt->filters[cvt->filter_index] (cvt, format);
234 }
235 }
236
237 static void SDLCALL
238 SDL_Convert_U8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
239 {
240 int i;
241 const Uint8 *src;
242 float *dst;
243
244 #ifdef DEBUG_CONVERT
245 fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32MSB.\n");
246 #endif
247
248 src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
249 dst = (float *) (cvt->buf + cvt->len_cvt * 4);
250 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
251 const float val = (((float) *src) * DIVBY255);
252 *dst = SDL_SwapFloatBE(val);
253 }
254
255 cvt->len_cvt *= 4;
256 format = AUDIO_F32MSB;
257 if (cvt->filters[++cvt->filter_index]) {
258 cvt->filters[cvt->filter_index] (cvt, format);
259 }
260 }
261
262 static void SDLCALL
263 SDL_Convert_S8_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
264 {
265 int i;
266 const Uint8 *src;
267 Uint8 *dst;
268
269 #ifdef DEBUG_CONVERT
270 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U8.\n");
271 #endif
272
273 src = (const Uint8 *) cvt->buf;
274 dst = (Uint8 *) cvt->buf;
275 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) {
276 const Uint8 val = ((((Sint8) *src)) ^ 0x80);
277 *dst = val;
278 }
279
280 format = AUDIO_U8;
281 if (cvt->filters[++cvt->filter_index]) {
282 cvt->filters[cvt->filter_index] (cvt, format);
283 }
284 }
285
286 static void SDLCALL
287 SDL_Convert_S8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
288 {
289 int i;
290 const Uint8 *src;
291 Uint16 *dst;
292
293 #ifdef DEBUG_CONVERT
294 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16LSB.\n");
295 #endif
296
297 src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
298 dst = (Uint16 *) (cvt->buf + cvt->len_cvt * 2);
299 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
300 const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8);
301 *dst = SDL_SwapLE16(val);
302 }
303
304 cvt->len_cvt *= 2;
305 format = AUDIO_U16LSB;
306 if (cvt->filters[++cvt->filter_index]) {
307 cvt->filters[cvt->filter_index] (cvt, format);
308 }
309 }
310
311 static void SDLCALL
312 SDL_Convert_S8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
313 {
314 int i;
315 const Uint8 *src;
316 Sint16 *dst;
317
318 #ifdef DEBUG_CONVERT
319 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16LSB.\n");
320 #endif
321
322 src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
323 dst = (Sint16 *) (cvt->buf + cvt->len_cvt * 2);
324 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
325 const Sint16 val = (((Sint16) ((Sint8) *src)) << 8);
326 *dst = ((Sint16) SDL_SwapLE16(val));
327 }
328
329 cvt->len_cvt *= 2;
330 format = AUDIO_S16LSB;
331 if (cvt->filters[++cvt->filter_index]) {
332 cvt->filters[cvt->filter_index] (cvt, format);
333 }
334 }
335
336 static void SDLCALL
337 SDL_Convert_S8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
338 {
339 int i;
340 const Uint8 *src;
341 Uint16 *dst;
342
343 #ifdef DEBUG_CONVERT
344 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16MSB.\n");
345 #endif
346
347 src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
348 dst = (Uint16 *) (cvt->buf + cvt->len_cvt * 2);
349 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
350 const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8);
351 *dst = SDL_SwapBE16(val);
352 }
353
354 cvt->len_cvt *= 2;
355 format = AUDIO_U16MSB;
356 if (cvt->filters[++cvt->filter_index]) {
357 cvt->filters[cvt->filter_index] (cvt, format);
358 }
359 }
360
361 static void SDLCALL
362 SDL_Convert_S8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
363 {
364 int i;
365 const Uint8 *src;
366 Sint16 *dst;
367
368 #ifdef DEBUG_CONVERT
369 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16MSB.\n");
370 #endif
371
372 src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
373 dst = (Sint16 *) (cvt->buf + cvt->len_cvt * 2);
374 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
375 const Sint16 val = (((Sint16) ((Sint8) *src)) << 8);
376 *dst = ((Sint16) SDL_SwapBE16(val));
377 }
378
379 cvt->len_cvt *= 2;
380 format = AUDIO_S16MSB;
381 if (cvt->filters[++cvt->filter_index]) {
382 cvt->filters[cvt->filter_index] (cvt, format);
383 }
384 }
385
386 static void SDLCALL
387 SDL_Convert_S8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
388 {
389 int i;
390 const Uint8 *src;
391 Sint32 *dst;
392
393 #ifdef DEBUG_CONVERT
394 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32LSB.\n");
395 #endif
396
397 src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
398 dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 4);
399 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
400 const Sint32 val = (((Sint32) ((Sint8) *src)) << 24);
401 *dst = ((Sint32) SDL_SwapLE32(val));
402 }
403
404 cvt->len_cvt *= 4;
405 format = AUDIO_S32LSB;
406 if (cvt->filters[++cvt->filter_index]) {
407 cvt->filters[cvt->filter_index] (cvt, format);
408 }
409 }
410
411 static void SDLCALL
412 SDL_Convert_S8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
413 {
414 int i;
415 const Uint8 *src;
416 Sint32 *dst;
417
418 #ifdef DEBUG_CONVERT
419 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32MSB.\n");
420 #endif
421
422 src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
423 dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 4);
424 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
425 const Sint32 val = (((Sint32) ((Sint8) *src)) << 24);
426 *dst = ((Sint32) SDL_SwapBE32(val));
427 }
428
429 cvt->len_cvt *= 4;
430 format = AUDIO_S32MSB;
431 if (cvt->filters[++cvt->filter_index]) {
432 cvt->filters[cvt->filter_index] (cvt, format);
433 }
434 }
435
436 static void SDLCALL
437 SDL_Convert_S8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
438 {
439 int i;
440 const Uint8 *src;
441 float *dst;
442
443 #ifdef DEBUG_CONVERT
444 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32LSB.\n");
445 #endif
446
447 src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
448 dst = (float *) (cvt->buf + cvt->len_cvt * 4);
449 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
450 const float val = (((float) ((Sint8) *src)) * DIVBY127);
451 *dst = SDL_SwapFloatLE(val);
452 }
453
454 cvt->len_cvt *= 4;
455 format = AUDIO_F32LSB;
456 if (cvt->filters[++cvt->filter_index]) {
457 cvt->filters[cvt->filter_index] (cvt, format);
458 }
459 }
460
461 static void SDLCALL
462 SDL_Convert_S8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
463 {
464 int i;
465 const Uint8 *src;
466 float *dst;
467
468 #ifdef DEBUG_CONVERT
469 fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32MSB.\n");
470 #endif
471
472 src = (const Uint8 *) (cvt->buf + cvt->len_cvt);
473 dst = (float *) (cvt->buf + cvt->len_cvt * 4);
474 for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) {
475 const float val = (((float) ((Sint8) *src)) * DIVBY127);
476 *dst = SDL_SwapFloatBE(val);
477 }
478
479 cvt->len_cvt *= 4;
480 format = AUDIO_F32MSB;
481 if (cvt->filters[++cvt->filter_index]) {
482 cvt->filters[cvt->filter_index] (cvt, format);
483 }
484 }
485
486 static void SDLCALL
487 SDL_Convert_U16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
488 {
489 int i;
490 const Uint16 *src;
491 Uint8 *dst;
492
493 #ifdef DEBUG_CONVERT
494 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U8.\n");
495 #endif
496
497 src = (const Uint16 *) cvt->buf;
498 dst = (Uint8 *) cvt->buf;
499 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
500 const Uint8 val = ((Uint8) (SDL_SwapLE16(*src) >> 8));
501 *dst = val;
502 }
503
504 cvt->len_cvt /= 2;
505 format = AUDIO_U8;
506 if (cvt->filters[++cvt->filter_index]) {
507 cvt->filters[cvt->filter_index] (cvt, format);
508 }
509 }
510
511 static void SDLCALL
512 SDL_Convert_U16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
513 {
514 int i;
515 const Uint16 *src;
516 Sint8 *dst;
517
518 #ifdef DEBUG_CONVERT
519 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S8.\n");
520 #endif
521
522 src = (const Uint16 *) cvt->buf;
523 dst = (Sint8 *) cvt->buf;
524 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
525 const Sint8 val = ((Sint8) (((SDL_SwapLE16(*src)) ^ 0x8000) >> 8));
526 *dst = ((Sint8) val);
527 }
528
529 cvt->len_cvt /= 2;
530 format = AUDIO_S8;
531 if (cvt->filters[++cvt->filter_index]) {
532 cvt->filters[cvt->filter_index] (cvt, format);
533 }
534 }
535
536 static void SDLCALL
537 SDL_Convert_U16LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
538 {
539 int i;
540 const Uint16 *src;
541 Sint16 *dst;
542
543 #ifdef DEBUG_CONVERT
544 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16LSB.\n");
545 #endif
546
547 src = (const Uint16 *) cvt->buf;
548 dst = (Sint16 *) cvt->buf;
549 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
550 const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000);
551 *dst = ((Sint16) SDL_SwapLE16(val));
552 }
553
554 format = AUDIO_S16LSB;
555 if (cvt->filters[++cvt->filter_index]) {
556 cvt->filters[cvt->filter_index] (cvt, format);
557 }
558 }
559
560 static void SDLCALL
561 SDL_Convert_U16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
562 {
563 int i;
564 const Uint16 *src;
565 Uint16 *dst;
566
567 #ifdef DEBUG_CONVERT
568 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U16MSB.\n");
569 #endif
570
571 src = (const Uint16 *) cvt->buf;
572 dst = (Uint16 *) cvt->buf;
573 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
574 const Uint16 val = SDL_SwapLE16(*src);
575 *dst = SDL_SwapBE16(val);
576 }
577
578 format = AUDIO_U16MSB;
579 if (cvt->filters[++cvt->filter_index]) {
580 cvt->filters[cvt->filter_index] (cvt, format);
581 }
582 }
583
584 static void SDLCALL
585 SDL_Convert_U16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
586 {
587 int i;
588 const Uint16 *src;
589 Sint16 *dst;
590
591 #ifdef DEBUG_CONVERT
592 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16MSB.\n");
593 #endif
594
595 src = (const Uint16 *) cvt->buf;
596 dst = (Sint16 *) cvt->buf;
597 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
598 const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000);
599 *dst = ((Sint16) SDL_SwapBE16(val));
600 }
601
602 format = AUDIO_S16MSB;
603 if (cvt->filters[++cvt->filter_index]) {
604 cvt->filters[cvt->filter_index] (cvt, format);
605 }
606 }
607
608 static void SDLCALL
609 SDL_Convert_U16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
610 {
611 int i;
612 const Uint16 *src;
613 Sint32 *dst;
614
615 #ifdef DEBUG_CONVERT
616 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32LSB.\n");
617 #endif
618
619 src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
620 dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
621 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
622 const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16);
623 *dst = ((Sint32) SDL_SwapLE32(val));
624 }
625
626 cvt->len_cvt *= 2;
627 format = AUDIO_S32LSB;
628 if (cvt->filters[++cvt->filter_index]) {
629 cvt->filters[cvt->filter_index] (cvt, format);
630 }
631 }
632
633 static void SDLCALL
634 SDL_Convert_U16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
635 {
636 int i;
637 const Uint16 *src;
638 Sint32 *dst;
639
640 #ifdef DEBUG_CONVERT
641 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32MSB.\n");
642 #endif
643
644 src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
645 dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
646 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
647 const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16);
648 *dst = ((Sint32) SDL_SwapBE32(val));
649 }
650
651 cvt->len_cvt *= 2;
652 format = AUDIO_S32MSB;
653 if (cvt->filters[++cvt->filter_index]) {
654 cvt->filters[cvt->filter_index] (cvt, format);
655 }
656 }
657
658 static void SDLCALL
659 SDL_Convert_U16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
660 {
661 int i;
662 const Uint16 *src;
663 float *dst;
664
665 #ifdef DEBUG_CONVERT
666 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32LSB.\n");
667 #endif
668
669 src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
670 dst = (float *) (cvt->buf + cvt->len_cvt * 2);
671 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
672 const float val = (((float) SDL_SwapLE16(*src)) * DIVBY65535);
673 *dst = SDL_SwapFloatLE(val);
674 }
675
676 cvt->len_cvt *= 2;
677 format = AUDIO_F32LSB;
678 if (cvt->filters[++cvt->filter_index]) {
679 cvt->filters[cvt->filter_index] (cvt, format);
680 }
681 }
682
683 static void SDLCALL
684 SDL_Convert_U16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
685 {
686 int i;
687 const Uint16 *src;
688 float *dst;
689
690 #ifdef DEBUG_CONVERT
691 fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32MSB.\n");
692 #endif
693
694 src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
695 dst = (float *) (cvt->buf + cvt->len_cvt * 2);
696 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
697 const float val = (((float) SDL_SwapLE16(*src)) * DIVBY65535);
698 *dst = SDL_SwapFloatBE(val);
699 }
700
701 cvt->len_cvt *= 2;
702 format = AUDIO_F32MSB;
703 if (cvt->filters[++cvt->filter_index]) {
704 cvt->filters[cvt->filter_index] (cvt, format);
705 }
706 }
707
708 static void SDLCALL
709 SDL_Convert_S16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
710 {
711 int i;
712 const Uint16 *src;
713 Uint8 *dst;
714
715 #ifdef DEBUG_CONVERT
716 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U8.\n");
717 #endif
718
719 src = (const Uint16 *) cvt->buf;
720 dst = (Uint8 *) cvt->buf;
721 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
722 const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000) >> 8));
723 *dst = val;
724 }
725
726 cvt->len_cvt /= 2;
727 format = AUDIO_U8;
728 if (cvt->filters[++cvt->filter_index]) {
729 cvt->filters[cvt->filter_index] (cvt, format);
730 }
731 }
732
733 static void SDLCALL
734 SDL_Convert_S16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
735 {
736 int i;
737 const Uint16 *src;
738 Sint8 *dst;
739
740 #ifdef DEBUG_CONVERT
741 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S8.\n");
742 #endif
743
744 src = (const Uint16 *) cvt->buf;
745 dst = (Sint8 *) cvt->buf;
746 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
747 const Sint8 val = ((Sint8) (((Sint16) SDL_SwapLE16(*src)) >> 8));
748 *dst = ((Sint8) val);
749 }
750
751 cvt->len_cvt /= 2;
752 format = AUDIO_S8;
753 if (cvt->filters[++cvt->filter_index]) {
754 cvt->filters[cvt->filter_index] (cvt, format);
755 }
756 }
757
758 static void SDLCALL
759 SDL_Convert_S16LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
760 {
761 int i;
762 const Uint16 *src;
763 Uint16 *dst;
764
765 #ifdef DEBUG_CONVERT
766 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16LSB.\n");
767 #endif
768
769 src = (const Uint16 *) cvt->buf;
770 dst = (Uint16 *) cvt->buf;
771 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
772 const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000);
773 *dst = SDL_SwapLE16(val);
774 }
775
776 format = AUDIO_U16LSB;
777 if (cvt->filters[++cvt->filter_index]) {
778 cvt->filters[cvt->filter_index] (cvt, format);
779 }
780 }
781
782 static void SDLCALL
783 SDL_Convert_S16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
784 {
785 int i;
786 const Uint16 *src;
787 Uint16 *dst;
788
789 #ifdef DEBUG_CONVERT
790 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16MSB.\n");
791 #endif
792
793 src = (const Uint16 *) cvt->buf;
794 dst = (Uint16 *) cvt->buf;
795 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
796 const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000);
797 *dst = SDL_SwapBE16(val);
798 }
799
800 format = AUDIO_U16MSB;
801 if (cvt->filters[++cvt->filter_index]) {
802 cvt->filters[cvt->filter_index] (cvt, format);
803 }
804 }
805
806 static void SDLCALL
807 SDL_Convert_S16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
808 {
809 int i;
810 const Uint16 *src;
811 Sint16 *dst;
812
813 #ifdef DEBUG_CONVERT
814 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S16MSB.\n");
815 #endif
816
817 src = (const Uint16 *) cvt->buf;
818 dst = (Sint16 *) cvt->buf;
819 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
820 const Sint16 val = ((Sint16) SDL_SwapLE16(*src));
821 *dst = ((Sint16) SDL_SwapBE16(val));
822 }
823
824 format = AUDIO_S16MSB;
825 if (cvt->filters[++cvt->filter_index]) {
826 cvt->filters[cvt->filter_index] (cvt, format);
827 }
828 }
829
830 static void SDLCALL
831 SDL_Convert_S16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
832 {
833 int i;
834 const Uint16 *src;
835 Sint32 *dst;
836
837 #ifdef DEBUG_CONVERT
838 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32LSB.\n");
839 #endif
840
841 src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
842 dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
843 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
844 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16);
845 *dst = ((Sint32) SDL_SwapLE32(val));
846 }
847
848 cvt->len_cvt *= 2;
849 format = AUDIO_S32LSB;
850 if (cvt->filters[++cvt->filter_index]) {
851 cvt->filters[cvt->filter_index] (cvt, format);
852 }
853 }
854
855 static void SDLCALL
856 SDL_Convert_S16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
857 {
858 int i;
859 const Uint16 *src;
860 Sint32 *dst;
861
862 #ifdef DEBUG_CONVERT
863 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32MSB.\n");
864 #endif
865
866 src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
867 dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
868 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
869 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16);
870 *dst = ((Sint32) SDL_SwapBE32(val));
871 }
872
873 cvt->len_cvt *= 2;
874 format = AUDIO_S32MSB;
875 if (cvt->filters[++cvt->filter_index]) {
876 cvt->filters[cvt->filter_index] (cvt, format);
877 }
878 }
879
880 static void SDLCALL
881 SDL_Convert_S16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
882 {
883 int i;
884 const Uint16 *src;
885 float *dst;
886
887 #ifdef DEBUG_CONVERT
888 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32LSB.\n");
889 #endif
890
891 src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
892 dst = (float *) (cvt->buf + cvt->len_cvt * 2);
893 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
894 const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767);
895 *dst = SDL_SwapFloatLE(val);
896 }
897
898 cvt->len_cvt *= 2;
899 format = AUDIO_F32LSB;
900 if (cvt->filters[++cvt->filter_index]) {
901 cvt->filters[cvt->filter_index] (cvt, format);
902 }
903 }
904
905 static void SDLCALL
906 SDL_Convert_S16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
907 {
908 int i;
909 const Uint16 *src;
910 float *dst;
911
912 #ifdef DEBUG_CONVERT
913 fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32MSB.\n");
914 #endif
915
916 src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
917 dst = (float *) (cvt->buf + cvt->len_cvt * 2);
918 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
919 const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767);
920 *dst = SDL_SwapFloatBE(val);
921 }
922
923 cvt->len_cvt *= 2;
924 format = AUDIO_F32MSB;
925 if (cvt->filters[++cvt->filter_index]) {
926 cvt->filters[cvt->filter_index] (cvt, format);
927 }
928 }
929
930 static void SDLCALL
931 SDL_Convert_U16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
932 {
933 int i;
934 const Uint16 *src;
935 Uint8 *dst;
936
937 #ifdef DEBUG_CONVERT
938 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U8.\n");
939 #endif
940
941 src = (const Uint16 *) cvt->buf;
942 dst = (Uint8 *) cvt->buf;
943 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
944 const Uint8 val = ((Uint8) (SDL_SwapBE16(*src) >> 8));
945 *dst = val;
946 }
947
948 cvt->len_cvt /= 2;
949 format = AUDIO_U8;
950 if (cvt->filters[++cvt->filter_index]) {
951 cvt->filters[cvt->filter_index] (cvt, format);
952 }
953 }
954
955 static void SDLCALL
956 SDL_Convert_U16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
957 {
958 int i;
959 const Uint16 *src;
960 Sint8 *dst;
961
962 #ifdef DEBUG_CONVERT
963 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S8.\n");
964 #endif
965
966 src = (const Uint16 *) cvt->buf;
967 dst = (Sint8 *) cvt->buf;
968 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
969 const Sint8 val = ((Sint8) (((SDL_SwapBE16(*src)) ^ 0x8000) >> 8));
970 *dst = ((Sint8) val);
971 }
972
973 cvt->len_cvt /= 2;
974 format = AUDIO_S8;
975 if (cvt->filters[++cvt->filter_index]) {
976 cvt->filters[cvt->filter_index] (cvt, format);
977 }
978 }
979
980 static void SDLCALL
981 SDL_Convert_U16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
982 {
983 int i;
984 const Uint16 *src;
985 Uint16 *dst;
986
987 #ifdef DEBUG_CONVERT
988 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U16LSB.\n");
989 #endif
990
991 src = (const Uint16 *) cvt->buf;
992 dst = (Uint16 *) cvt->buf;
993 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
994 const Uint16 val = SDL_SwapBE16(*src);
995 *dst = SDL_SwapLE16(val);
996 }
997
998 format = AUDIO_U16LSB;
999 if (cvt->filters[++cvt->filter_index]) {
1000 cvt->filters[cvt->filter_index] (cvt, format);
1001 }
1002 }
1003
1004 static void SDLCALL
1005 SDL_Convert_U16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1006 {
1007 int i;
1008 const Uint16 *src;
1009 Sint16 *dst;
1010
1011 #ifdef DEBUG_CONVERT
1012 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16LSB.\n");
1013 #endif
1014
1015 src = (const Uint16 *) cvt->buf;
1016 dst = (Sint16 *) cvt->buf;
1017 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1018 const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000);
1019 *dst = ((Sint16) SDL_SwapLE16(val));
1020 }
1021
1022 format = AUDIO_S16LSB;
1023 if (cvt->filters[++cvt->filter_index]) {
1024 cvt->filters[cvt->filter_index] (cvt, format);
1025 }
1026 }
1027
1028 static void SDLCALL
1029 SDL_Convert_U16MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1030 {
1031 int i;
1032 const Uint16 *src;
1033 Sint16 *dst;
1034
1035 #ifdef DEBUG_CONVERT
1036 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16MSB.\n");
1037 #endif
1038
1039 src = (const Uint16 *) cvt->buf;
1040 dst = (Sint16 *) cvt->buf;
1041 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1042 const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000);
1043 *dst = ((Sint16) SDL_SwapBE16(val));
1044 }
1045
1046 format = AUDIO_S16MSB;
1047 if (cvt->filters[++cvt->filter_index]) {
1048 cvt->filters[cvt->filter_index] (cvt, format);
1049 }
1050 }
1051
1052 static void SDLCALL
1053 SDL_Convert_U16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1054 {
1055 int i;
1056 const Uint16 *src;
1057 Sint32 *dst;
1058
1059 #ifdef DEBUG_CONVERT
1060 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32LSB.\n");
1061 #endif
1062
1063 src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1064 dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
1065 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1066 const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16);
1067 *dst = ((Sint32) SDL_SwapLE32(val));
1068 }
1069
1070 cvt->len_cvt *= 2;
1071 format = AUDIO_S32LSB;
1072 if (cvt->filters[++cvt->filter_index]) {
1073 cvt->filters[cvt->filter_index] (cvt, format);
1074 }
1075 }
1076
1077 static void SDLCALL
1078 SDL_Convert_U16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1079 {
1080 int i;
1081 const Uint16 *src;
1082 Sint32 *dst;
1083
1084 #ifdef DEBUG_CONVERT
1085 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32MSB.\n");
1086 #endif
1087
1088 src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1089 dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
1090 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1091 const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16);
1092 *dst = ((Sint32) SDL_SwapBE32(val));
1093 }
1094
1095 cvt->len_cvt *= 2;
1096 format = AUDIO_S32MSB;
1097 if (cvt->filters[++cvt->filter_index]) {
1098 cvt->filters[cvt->filter_index] (cvt, format);
1099 }
1100 }
1101
1102 static void SDLCALL
1103 SDL_Convert_U16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1104 {
1105 int i;
1106 const Uint16 *src;
1107 float *dst;
1108
1109 #ifdef DEBUG_CONVERT
1110 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32LSB.\n");
1111 #endif
1112
1113 src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1114 dst = (float *) (cvt->buf + cvt->len_cvt * 2);
1115 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1116 const float val = (((float) SDL_SwapBE16(*src)) * DIVBY65535);
1117 *dst = SDL_SwapFloatLE(val);
1118 }
1119
1120 cvt->len_cvt *= 2;
1121 format = AUDIO_F32LSB;
1122 if (cvt->filters[++cvt->filter_index]) {
1123 cvt->filters[cvt->filter_index] (cvt, format);
1124 }
1125 }
1126
1127 static void SDLCALL
1128 SDL_Convert_U16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1129 {
1130 int i;
1131 const Uint16 *src;
1132 float *dst;
1133
1134 #ifdef DEBUG_CONVERT
1135 fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32MSB.\n");
1136 #endif
1137
1138 src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1139 dst = (float *) (cvt->buf + cvt->len_cvt * 2);
1140 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1141 const float val = (((float) SDL_SwapBE16(*src)) * DIVBY65535);
1142 *dst = SDL_SwapFloatBE(val);
1143 }
1144
1145 cvt->len_cvt *= 2;
1146 format = AUDIO_F32MSB;
1147 if (cvt->filters[++cvt->filter_index]) {
1148 cvt->filters[cvt->filter_index] (cvt, format);
1149 }
1150 }
1151
1152 static void SDLCALL
1153 SDL_Convert_S16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1154 {
1155 int i;
1156 const Uint16 *src;
1157 Uint8 *dst;
1158
1159 #ifdef DEBUG_CONVERT
1160 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U8.\n");
1161 #endif
1162
1163 src = (const Uint16 *) cvt->buf;
1164 dst = (Uint8 *) cvt->buf;
1165 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1166 const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000) >> 8));
1167 *dst = val;
1168 }
1169
1170 cvt->len_cvt /= 2;
1171 format = AUDIO_U8;
1172 if (cvt->filters[++cvt->filter_index]) {
1173 cvt->filters[cvt->filter_index] (cvt, format);
1174 }
1175 }
1176
1177 static void SDLCALL
1178 SDL_Convert_S16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1179 {
1180 int i;
1181 const Uint16 *src;
1182 Sint8 *dst;
1183
1184 #ifdef DEBUG_CONVERT
1185 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S8.\n");
1186 #endif
1187
1188 src = (const Uint16 *) cvt->buf;
1189 dst = (Sint8 *) cvt->buf;
1190 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1191 const Sint8 val = ((Sint8) (((Sint16) SDL_SwapBE16(*src)) >> 8));
1192 *dst = ((Sint8) val);
1193 }
1194
1195 cvt->len_cvt /= 2;
1196 format = AUDIO_S8;
1197 if (cvt->filters[++cvt->filter_index]) {
1198 cvt->filters[cvt->filter_index] (cvt, format);
1199 }
1200 }
1201
1202 static void SDLCALL
1203 SDL_Convert_S16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1204 {
1205 int i;
1206 const Uint16 *src;
1207 Uint16 *dst;
1208
1209 #ifdef DEBUG_CONVERT
1210 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16LSB.\n");
1211 #endif
1212
1213 src = (const Uint16 *) cvt->buf;
1214 dst = (Uint16 *) cvt->buf;
1215 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1216 const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000);
1217 *dst = SDL_SwapLE16(val);
1218 }
1219
1220 format = AUDIO_U16LSB;
1221 if (cvt->filters[++cvt->filter_index]) {
1222 cvt->filters[cvt->filter_index] (cvt, format);
1223 }
1224 }
1225
1226 static void SDLCALL
1227 SDL_Convert_S16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1228 {
1229 int i;
1230 const Uint16 *src;
1231 Sint16 *dst;
1232
1233 #ifdef DEBUG_CONVERT
1234 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S16LSB.\n");
1235 #endif
1236
1237 src = (const Uint16 *) cvt->buf;
1238 dst = (Sint16 *) cvt->buf;
1239 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1240 const Sint16 val = ((Sint16) SDL_SwapBE16(*src));
1241 *dst = ((Sint16) SDL_SwapLE16(val));
1242 }
1243
1244 format = AUDIO_S16LSB;
1245 if (cvt->filters[++cvt->filter_index]) {
1246 cvt->filters[cvt->filter_index] (cvt, format);
1247 }
1248 }
1249
1250 static void SDLCALL
1251 SDL_Convert_S16MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1252 {
1253 int i;
1254 const Uint16 *src;
1255 Uint16 *dst;
1256
1257 #ifdef DEBUG_CONVERT
1258 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16MSB.\n");
1259 #endif
1260
1261 src = (const Uint16 *) cvt->buf;
1262 dst = (Uint16 *) cvt->buf;
1263 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) {
1264 const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000);
1265 *dst = SDL_SwapBE16(val);
1266 }
1267
1268 format = AUDIO_U16MSB;
1269 if (cvt->filters[++cvt->filter_index]) {
1270 cvt->filters[cvt->filter_index] (cvt, format);
1271 }
1272 }
1273
1274 static void SDLCALL
1275 SDL_Convert_S16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1276 {
1277 int i;
1278 const Uint16 *src;
1279 Sint32 *dst;
1280
1281 #ifdef DEBUG_CONVERT
1282 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32LSB.\n");
1283 #endif
1284
1285 src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1286 dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
1287 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1288 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16);
1289 *dst = ((Sint32) SDL_SwapLE32(val));
1290 }
1291
1292 cvt->len_cvt *= 2;
1293 format = AUDIO_S32LSB;
1294 if (cvt->filters[++cvt->filter_index]) {
1295 cvt->filters[cvt->filter_index] (cvt, format);
1296 }
1297 }
1298
1299 static void SDLCALL
1300 SDL_Convert_S16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1301 {
1302 int i;
1303 const Uint16 *src;
1304 Sint32 *dst;
1305
1306 #ifdef DEBUG_CONVERT
1307 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32MSB.\n");
1308 #endif
1309
1310 src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1311 dst = (Sint32 *) (cvt->buf + cvt->len_cvt * 2);
1312 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1313 const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16);
1314 *dst = ((Sint32) SDL_SwapBE32(val));
1315 }
1316
1317 cvt->len_cvt *= 2;
1318 format = AUDIO_S32MSB;
1319 if (cvt->filters[++cvt->filter_index]) {
1320 cvt->filters[cvt->filter_index] (cvt, format);
1321 }
1322 }
1323
1324 static void SDLCALL
1325 SDL_Convert_S16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1326 {
1327 int i;
1328 const Uint16 *src;
1329 float *dst;
1330
1331 #ifdef DEBUG_CONVERT
1332 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32LSB.\n");
1333 #endif
1334
1335 src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1336 dst = (float *) (cvt->buf + cvt->len_cvt * 2);
1337 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1338 const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767);
1339 *dst = SDL_SwapFloatLE(val);
1340 }
1341
1342 cvt->len_cvt *= 2;
1343 format = AUDIO_F32LSB;
1344 if (cvt->filters[++cvt->filter_index]) {
1345 cvt->filters[cvt->filter_index] (cvt, format);
1346 }
1347 }
1348
1349 static void SDLCALL
1350 SDL_Convert_S16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1351 {
1352 int i;
1353 const Uint16 *src;
1354 float *dst;
1355
1356 #ifdef DEBUG_CONVERT
1357 fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32MSB.\n");
1358 #endif
1359
1360 src = (const Uint16 *) (cvt->buf + cvt->len_cvt);
1361 dst = (float *) (cvt->buf + cvt->len_cvt * 2);
1362 for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) {
1363 const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767);
1364 *dst = SDL_SwapFloatBE(val);
1365 }
1366
1367 cvt->len_cvt *= 2;
1368 format = AUDIO_F32MSB;
1369 if (cvt->filters[++cvt->filter_index]) {
1370 cvt->filters[cvt->filter_index] (cvt, format);
1371 }
1372 }
1373
1374 static void SDLCALL
1375 SDL_Convert_S32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1376 {
1377 int i;
1378 const Uint32 *src;
1379 Uint8 *dst;
1380
1381 #ifdef DEBUG_CONVERT
1382 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U8.\n");
1383 #endif
1384
1385 src = (const Uint32 *) cvt->buf;
1386 dst = (Uint8 *) cvt->buf;
1387 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1388 const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 24));
1389 *dst = val;
1390 }
1391
1392 cvt->len_cvt /= 4;
1393 format = AUDIO_U8;
1394 if (cvt->filters[++cvt->filter_index]) {
1395 cvt->filters[cvt->filter_index] (cvt, format);
1396 }
1397 }
1398
1399 static void SDLCALL
1400 SDL_Convert_S32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1401 {
1402 int i;
1403 const Uint32 *src;
1404 Sint8 *dst;
1405
1406 #ifdef DEBUG_CONVERT
1407 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S8.\n");
1408 #endif
1409
1410 src = (const Uint32 *) cvt->buf;
1411 dst = (Sint8 *) cvt->buf;
1412 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1413 const Sint8 val = ((Sint8) (((Sint32) SDL_SwapLE32(*src)) >> 24));
1414 *dst = ((Sint8) val);
1415 }
1416
1417 cvt->len_cvt /= 4;
1418 format = AUDIO_S8;
1419 if (cvt->filters[++cvt->filter_index]) {
1420 cvt->filters[cvt->filter_index] (cvt, format);
1421 }
1422 }
1423
1424 static void SDLCALL
1425 SDL_Convert_S32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1426 {
1427 int i;
1428 const Uint32 *src;
1429 Uint16 *dst;
1430
1431 #ifdef DEBUG_CONVERT
1432 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16LSB.\n");
1433 #endif
1434
1435 src = (const Uint32 *) cvt->buf;
1436 dst = (Uint16 *) cvt->buf;
1437 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1438 const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16));
1439 *dst = SDL_SwapLE16(val);
1440 }
1441
1442 cvt->len_cvt /= 2;
1443 format = AUDIO_U16LSB;
1444 if (cvt->filters[++cvt->filter_index]) {
1445 cvt->filters[cvt->filter_index] (cvt, format);
1446 }
1447 }
1448
1449 static void SDLCALL
1450 SDL_Convert_S32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1451 {
1452 int i;
1453 const Uint32 *src;
1454 Sint16 *dst;
1455
1456 #ifdef DEBUG_CONVERT
1457 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16LSB.\n");
1458 #endif
1459
1460 src = (const Uint32 *) cvt->buf;
1461 dst = (Sint16 *) cvt->buf;
1462 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1463 const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16));
1464 *dst = ((Sint16) SDL_SwapLE16(val));
1465 }
1466
1467 cvt->len_cvt /= 2;
1468 format = AUDIO_S16LSB;
1469 if (cvt->filters[++cvt->filter_index]) {
1470 cvt->filters[cvt->filter_index] (cvt, format);
1471 }
1472 }
1473
1474 static void SDLCALL
1475 SDL_Convert_S32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1476 {
1477 int i;
1478 const Uint32 *src;
1479 Uint16 *dst;
1480
1481 #ifdef DEBUG_CONVERT
1482 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16MSB.\n");
1483 #endif
1484
1485 src = (const Uint32 *) cvt->buf;
1486 dst = (Uint16 *) cvt->buf;
1487 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1488 const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16));
1489 *dst = SDL_SwapBE16(val);
1490 }
1491
1492 cvt->len_cvt /= 2;
1493 format = AUDIO_U16MSB;
1494 if (cvt->filters[++cvt->filter_index]) {
1495 cvt->filters[cvt->filter_index] (cvt, format);
1496 }
1497 }
1498
1499 static void SDLCALL
1500 SDL_Convert_S32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1501 {
1502 int i;
1503 const Uint32 *src;
1504 Sint16 *dst;
1505
1506 #ifdef DEBUG_CONVERT
1507 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16MSB.\n");
1508 #endif
1509
1510 src = (const Uint32 *) cvt->buf;
1511 dst = (Sint16 *) cvt->buf;
1512 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1513 const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16));
1514 *dst = ((Sint16) SDL_SwapBE16(val));
1515 }
1516
1517 cvt->len_cvt /= 2;
1518 format = AUDIO_S16MSB;
1519 if (cvt->filters[++cvt->filter_index]) {
1520 cvt->filters[cvt->filter_index] (cvt, format);
1521 }
1522 }
1523
1524 static void SDLCALL
1525 SDL_Convert_S32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1526 {
1527 int i;
1528 const Uint32 *src;
1529 Sint32 *dst;
1530
1531 #ifdef DEBUG_CONVERT
1532 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S32MSB.\n");
1533 #endif
1534
1535 src = (const Uint32 *) cvt->buf;
1536 dst = (Sint32 *) cvt->buf;
1537 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1538 const Sint32 val = ((Sint32) SDL_SwapLE32(*src));
1539 *dst = ((Sint32) SDL_SwapBE32(val));
1540 }
1541
1542 format = AUDIO_S32MSB;
1543 if (cvt->filters[++cvt->filter_index]) {
1544 cvt->filters[cvt->filter_index] (cvt, format);
1545 }
1546 }
1547
1548 static void SDLCALL
1549 SDL_Convert_S32LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1550 {
1551 int i;
1552 const Uint32 *src;
1553 float *dst;
1554
1555 #ifdef DEBUG_CONVERT
1556 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32LSB.\n");
1557 #endif
1558
1559 src = (const Uint32 *) cvt->buf;
1560 dst = (float *) cvt->buf;
1561 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1562 const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647);
1563 *dst = SDL_SwapFloatLE(val);
1564 }
1565
1566 format = AUDIO_F32LSB;
1567 if (cvt->filters[++cvt->filter_index]) {
1568 cvt->filters[cvt->filter_index] (cvt, format);
1569 }
1570 }
1571
1572 static void SDLCALL
1573 SDL_Convert_S32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1574 {
1575 int i;
1576 const Uint32 *src;
1577 float *dst;
1578
1579 #ifdef DEBUG_CONVERT
1580 fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32MSB.\n");
1581 #endif
1582
1583 src = (const Uint32 *) cvt->buf;
1584 dst = (float *) cvt->buf;
1585 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1586 const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647);
1587 *dst = SDL_SwapFloatBE(val);
1588 }
1589
1590 format = AUDIO_F32MSB;
1591 if (cvt->filters[++cvt->filter_index]) {
1592 cvt->filters[cvt->filter_index] (cvt, format);
1593 }
1594 }
1595
1596 static void SDLCALL
1597 SDL_Convert_S32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1598 {
1599 int i;
1600 const Uint32 *src;
1601 Uint8 *dst;
1602
1603 #ifdef DEBUG_CONVERT
1604 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U8.\n");
1605 #endif
1606
1607 src = (const Uint32 *) cvt->buf;
1608 dst = (Uint8 *) cvt->buf;
1609 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1610 const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 24));
1611 *dst = val;
1612 }
1613
1614 cvt->len_cvt /= 4;
1615 format = AUDIO_U8;
1616 if (cvt->filters[++cvt->filter_index]) {
1617 cvt->filters[cvt->filter_index] (cvt, format);
1618 }
1619 }
1620
1621 static void SDLCALL
1622 SDL_Convert_S32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1623 {
1624 int i;
1625 const Uint32 *src;
1626 Sint8 *dst;
1627
1628 #ifdef DEBUG_CONVERT
1629 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S8.\n");
1630 #endif
1631
1632 src = (const Uint32 *) cvt->buf;
1633 dst = (Sint8 *) cvt->buf;
1634 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1635 const Sint8 val = ((Sint8) (((Sint32) SDL_SwapBE32(*src)) >> 24));
1636 *dst = ((Sint8) val);
1637 }
1638
1639 cvt->len_cvt /= 4;
1640 format = AUDIO_S8;
1641 if (cvt->filters[++cvt->filter_index]) {
1642 cvt->filters[cvt->filter_index] (cvt, format);
1643 }
1644 }
1645
1646 static void SDLCALL
1647 SDL_Convert_S32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1648 {
1649 int i;
1650 const Uint32 *src;
1651 Uint16 *dst;
1652
1653 #ifdef DEBUG_CONVERT
1654 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16LSB.\n");
1655 #endif
1656
1657 src = (const Uint32 *) cvt->buf;
1658 dst = (Uint16 *) cvt->buf;
1659 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1660 const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16));
1661 *dst = SDL_SwapLE16(val);
1662 }
1663
1664 cvt->len_cvt /= 2;
1665 format = AUDIO_U16LSB;
1666 if (cvt->filters[++cvt->filter_index]) {
1667 cvt->filters[cvt->filter_index] (cvt, format);
1668 }
1669 }
1670
1671 static void SDLCALL
1672 SDL_Convert_S32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1673 {
1674 int i;
1675 const Uint32 *src;
1676 Sint16 *dst;
1677
1678 #ifdef DEBUG_CONVERT
1679 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16LSB.\n");
1680 #endif
1681
1682 src = (const Uint32 *) cvt->buf;
1683 dst = (Sint16 *) cvt->buf;
1684 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1685 const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16));
1686 *dst = ((Sint16) SDL_SwapLE16(val));
1687 }
1688
1689 cvt->len_cvt /= 2;
1690 format = AUDIO_S16LSB;
1691 if (cvt->filters[++cvt->filter_index]) {
1692 cvt->filters[cvt->filter_index] (cvt, format);
1693 }
1694 }
1695
1696 static void SDLCALL
1697 SDL_Convert_S32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1698 {
1699 int i;
1700 const Uint32 *src;
1701 Uint16 *dst;
1702
1703 #ifdef DEBUG_CONVERT
1704 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16MSB.\n");
1705 #endif
1706
1707 src = (const Uint32 *) cvt->buf;
1708 dst = (Uint16 *) cvt->buf;
1709 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1710 const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16));
1711 *dst = SDL_SwapBE16(val);
1712 }
1713
1714 cvt->len_cvt /= 2;
1715 format = AUDIO_U16MSB;
1716 if (cvt->filters[++cvt->filter_index]) {
1717 cvt->filters[cvt->filter_index] (cvt, format);
1718 }
1719 }
1720
1721 static void SDLCALL
1722 SDL_Convert_S32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1723 {
1724 int i;
1725 const Uint32 *src;
1726 Sint16 *dst;
1727
1728 #ifdef DEBUG_CONVERT
1729 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16MSB.\n");
1730 #endif
1731
1732 src = (const Uint32 *) cvt->buf;
1733 dst = (Sint16 *) cvt->buf;
1734 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1735 const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16));
1736 *dst = ((Sint16) SDL_SwapBE16(val));
1737 }
1738
1739 cvt->len_cvt /= 2;
1740 format = AUDIO_S16MSB;
1741 if (cvt->filters[++cvt->filter_index]) {
1742 cvt->filters[cvt->filter_index] (cvt, format);
1743 }
1744 }
1745
1746 static void SDLCALL
1747 SDL_Convert_S32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1748 {
1749 int i;
1750 const Uint32 *src;
1751 Sint32 *dst;
1752
1753 #ifdef DEBUG_CONVERT
1754 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S32LSB.\n");
1755 #endif
1756
1757 src = (const Uint32 *) cvt->buf;
1758 dst = (Sint32 *) cvt->buf;
1759 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1760 const Sint32 val = ((Sint32) SDL_SwapBE32(*src));
1761 *dst = ((Sint32) SDL_SwapLE32(val));
1762 }
1763
1764 format = AUDIO_S32LSB;
1765 if (cvt->filters[++cvt->filter_index]) {
1766 cvt->filters[cvt->filter_index] (cvt, format);
1767 }
1768 }
1769
1770 static void SDLCALL
1771 SDL_Convert_S32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1772 {
1773 int i;
1774 const Uint32 *src;
1775 float *dst;
1776
1777 #ifdef DEBUG_CONVERT
1778 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32LSB.\n");
1779 #endif
1780
1781 src = (const Uint32 *) cvt->buf;
1782 dst = (float *) cvt->buf;
1783 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1784 const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647);
1785 *dst = SDL_SwapFloatLE(val);
1786 }
1787
1788 format = AUDIO_F32LSB;
1789 if (cvt->filters[++cvt->filter_index]) {
1790 cvt->filters[cvt->filter_index] (cvt, format);
1791 }
1792 }
1793
1794 static void SDLCALL
1795 SDL_Convert_S32MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1796 {
1797 int i;
1798 const Uint32 *src;
1799 float *dst;
1800
1801 #ifdef DEBUG_CONVERT
1802 fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32MSB.\n");
1803 #endif
1804
1805 src = (const Uint32 *) cvt->buf;
1806 dst = (float *) cvt->buf;
1807 for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) {
1808 const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647);
1809 *dst = SDL_SwapFloatBE(val);
1810 }
1811
1812 format = AUDIO_F32MSB;
1813 if (cvt->filters[++cvt->filter_index]) {
1814 cvt->filters[cvt->filter_index] (cvt, format);
1815 }
1816 }
1817
1818 static void SDLCALL
1819 SDL_Convert_F32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1820 {
1821 int i;
1822 const float *src;
1823 Uint8 *dst;
1824
1825 #ifdef DEBUG_CONVERT
1826 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U8.\n");
1827 #endif
1828
1829 src = (const float *) cvt->buf;
1830 dst = (Uint8 *) cvt->buf;
1831 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1832 const Uint8 val = ((Uint8) (SDL_SwapFloatLE(*src) * 255.0f));
1833 *dst = val;
1834 }
1835
1836 cvt->len_cvt /= 4;
1837 format = AUDIO_U8;
1838 if (cvt->filters[++cvt->filter_index]) {
1839 cvt->filters[cvt->filter_index] (cvt, format);
1840 }
1841 }
1842
1843 static void SDLCALL
1844 SDL_Convert_F32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1845 {
1846 int i;
1847 const float *src;
1848 Sint8 *dst;
1849
1850 #ifdef DEBUG_CONVERT
1851 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S8.\n");
1852 #endif
1853
1854 src = (const float *) cvt->buf;
1855 dst = (Sint8 *) cvt->buf;
1856 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1857 const Sint8 val = ((Sint8) (SDL_SwapFloatLE(*src) * 127.0f));
1858 *dst = ((Sint8) val);
1859 }
1860
1861 cvt->len_cvt /= 4;
1862 format = AUDIO_S8;
1863 if (cvt->filters[++cvt->filter_index]) {
1864 cvt->filters[cvt->filter_index] (cvt, format);
1865 }
1866 }
1867
1868 static void SDLCALL
1869 SDL_Convert_F32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1870 {
1871 int i;
1872 const float *src;
1873 Uint16 *dst;
1874
1875 #ifdef DEBUG_CONVERT
1876 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16LSB.\n");
1877 #endif
1878
1879 src = (const float *) cvt->buf;
1880 dst = (Uint16 *) cvt->buf;
1881 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1882 const Uint16 val = ((Uint16) (SDL_SwapFloatLE(*src) * 65535.0f));
1883 *dst = SDL_SwapLE16(val);
1884 }
1885
1886 cvt->len_cvt /= 2;
1887 format = AUDIO_U16LSB;
1888 if (cvt->filters[++cvt->filter_index]) {
1889 cvt->filters[cvt->filter_index] (cvt, format);
1890 }
1891 }
1892
1893 static void SDLCALL
1894 SDL_Convert_F32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1895 {
1896 int i;
1897 const float *src;
1898 Sint16 *dst;
1899
1900 #ifdef DEBUG_CONVERT
1901 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16LSB.\n");
1902 #endif
1903
1904 src = (const float *) cvt->buf;
1905 dst = (Sint16 *) cvt->buf;
1906 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1907 const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f));
1908 *dst = ((Sint16) SDL_SwapLE16(val));
1909 }
1910
1911 cvt->len_cvt /= 2;
1912 format = AUDIO_S16LSB;
1913 if (cvt->filters[++cvt->filter_index]) {
1914 cvt->filters[cvt->filter_index] (cvt, format);
1915 }
1916 }
1917
1918 static void SDLCALL
1919 SDL_Convert_F32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1920 {
1921 int i;
1922 const float *src;
1923 Uint16 *dst;
1924
1925 #ifdef DEBUG_CONVERT
1926 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16MSB.\n");
1927 #endif
1928
1929 src = (const float *) cvt->buf;
1930 dst = (Uint16 *) cvt->buf;
1931 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1932 const Uint16 val = ((Uint16) (SDL_SwapFloatLE(*src) * 65535.0f));
1933 *dst = SDL_SwapBE16(val);
1934 }
1935
1936 cvt->len_cvt /= 2;
1937 format = AUDIO_U16MSB;
1938 if (cvt->filters[++cvt->filter_index]) {
1939 cvt->filters[cvt->filter_index] (cvt, format);
1940 }
1941 }
1942
1943 static void SDLCALL
1944 SDL_Convert_F32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1945 {
1946 int i;
1947 const float *src;
1948 Sint16 *dst;
1949
1950 #ifdef DEBUG_CONVERT
1951 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16MSB.\n");
1952 #endif
1953
1954 src = (const float *) cvt->buf;
1955 dst = (Sint16 *) cvt->buf;
1956 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1957 const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f));
1958 *dst = ((Sint16) SDL_SwapBE16(val));
1959 }
1960
1961 cvt->len_cvt /= 2;
1962 format = AUDIO_S16MSB;
1963 if (cvt->filters[++cvt->filter_index]) {
1964 cvt->filters[cvt->filter_index] (cvt, format);
1965 }
1966 }
1967
1968 static void SDLCALL
1969 SDL_Convert_F32LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1970 {
1971 int i;
1972 const float *src;
1973 Sint32 *dst;
1974
1975 #ifdef DEBUG_CONVERT
1976 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32LSB.\n");
1977 #endif
1978
1979 src = (const float *) cvt->buf;
1980 dst = (Sint32 *) cvt->buf;
1981 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
1982 const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0));
1983 *dst = ((Sint32) SDL_SwapLE32(val));
1984 }
1985
1986 format = AUDIO_S32LSB;
1987 if (cvt->filters[++cvt->filter_index]) {
1988 cvt->filters[cvt->filter_index] (cvt, format);
1989 }
1990 }
1991
1992 static void SDLCALL
1993 SDL_Convert_F32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
1994 {
1995 int i;
1996 const float *src;
1997 Sint32 *dst;
1998
1999 #ifdef DEBUG_CONVERT
2000 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32MSB.\n");
2001 #endif
2002
2003 src = (const float *) cvt->buf;
2004 dst = (Sint32 *) cvt->buf;
2005 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2006 const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0));
2007 *dst = ((Sint32) SDL_SwapBE32(val));
2008 }
2009
2010 format = AUDIO_S32MSB;
2011 if (cvt->filters[++cvt->filter_index]) {
2012 cvt->filters[cvt->filter_index] (cvt, format);
2013 }
2014 }
2015
2016 static void SDLCALL
2017 SDL_Convert_F32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2018 {
2019 int i;
2020 const float *src;
2021 float *dst;
2022
2023 #ifdef DEBUG_CONVERT
2024 fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_F32MSB.\n");
2025 #endif
2026
2027 src = (const float *) cvt->buf;
2028 dst = (float *) cvt->buf;
2029 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2030 const float val = SDL_SwapFloatLE(*src);
2031 *dst = SDL_SwapFloatBE(val);
2032 }
2033
2034 format = AUDIO_F32MSB;
2035 if (cvt->filters[++cvt->filter_index]) {
2036 cvt->filters[cvt->filter_index] (cvt, format);
2037 }
2038 }
2039
2040 static void SDLCALL
2041 SDL_Convert_F32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2042 {
2043 int i;
2044 const float *src;
2045 Uint8 *dst;
2046
2047 #ifdef DEBUG_CONVERT
2048 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U8.\n");
2049 #endif
2050
2051 src = (const float *) cvt->buf;
2052 dst = (Uint8 *) cvt->buf;
2053 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2054 const Uint8 val = ((Uint8) (SDL_SwapFloatBE(*src) * 255.0f));
2055 *dst = val;
2056 }
2057
2058 cvt->len_cvt /= 4;
2059 format = AUDIO_U8;
2060 if (cvt->filters[++cvt->filter_index]) {
2061 cvt->filters[cvt->filter_index] (cvt, format);
2062 }
2063 }
2064
2065 static void SDLCALL
2066 SDL_Convert_F32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2067 {
2068 int i;
2069 const float *src;
2070 Sint8 *dst;
2071
2072 #ifdef DEBUG_CONVERT
2073 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S8.\n");
2074 #endif
2075
2076 src = (const float *) cvt->buf;
2077 dst = (Sint8 *) cvt->buf;
2078 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2079 const Sint8 val = ((Sint8) (SDL_SwapFloatBE(*src) * 127.0f));
2080 *dst = ((Sint8) val);
2081 }
2082
2083 cvt->len_cvt /= 4;
2084 format = AUDIO_S8;
2085 if (cvt->filters[++cvt->filter_index]) {
2086 cvt->filters[cvt->filter_index] (cvt, format);
2087 }
2088 }
2089
2090 static void SDLCALL
2091 SDL_Convert_F32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2092 {
2093 int i;
2094 const float *src;
2095 Uint16 *dst;
2096
2097 #ifdef DEBUG_CONVERT
2098 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16LSB.\n");
2099 #endif
2100
2101 src = (const float *) cvt->buf;
2102 dst = (Uint16 *) cvt->buf;
2103 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2104 const Uint16 val = ((Uint16) (SDL_SwapFloatBE(*src) * 65535.0f));
2105 *dst = SDL_SwapLE16(val);
2106 }
2107
2108 cvt->len_cvt /= 2;
2109 format = AUDIO_U16LSB;
2110 if (cvt->filters[++cvt->filter_index]) {
2111 cvt->filters[cvt->filter_index] (cvt, format);
2112 }
2113 }
2114
2115 static void SDLCALL
2116 SDL_Convert_F32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2117 {
2118 int i;
2119 const float *src;
2120 Sint16 *dst;
2121
2122 #ifdef DEBUG_CONVERT
2123 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16LSB.\n");
2124 #endif
2125
2126 src = (const float *) cvt->buf;
2127 dst = (Sint16 *) cvt->buf;
2128 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2129 const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f));
2130 *dst = ((Sint16) SDL_SwapLE16(val));
2131 }
2132
2133 cvt->len_cvt /= 2;
2134 format = AUDIO_S16LSB;
2135 if (cvt->filters[++cvt->filter_index]) {
2136 cvt->filters[cvt->filter_index] (cvt, format);
2137 }
2138 }
2139
2140 static void SDLCALL
2141 SDL_Convert_F32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2142 {
2143 int i;
2144 const float *src;
2145 Uint16 *dst;
2146
2147 #ifdef DEBUG_CONVERT
2148 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16MSB.\n");
2149 #endif
2150
2151 src = (const float *) cvt->buf;
2152 dst = (Uint16 *) cvt->buf;
2153 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2154 const Uint16 val = ((Uint16) (SDL_SwapFloatBE(*src) * 65535.0f));
2155 *dst = SDL_SwapBE16(val);
2156 }
2157
2158 cvt->len_cvt /= 2;
2159 format = AUDIO_U16MSB;
2160 if (cvt->filters[++cvt->filter_index]) {
2161 cvt->filters[cvt->filter_index] (cvt, format);
2162 }
2163 }
2164
2165 static void SDLCALL
2166 SDL_Convert_F32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2167 {
2168 int i;
2169 const float *src;
2170 Sint16 *dst;
2171
2172 #ifdef DEBUG_CONVERT
2173 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16MSB.\n");
2174 #endif
2175
2176 src = (const float *) cvt->buf;
2177 dst = (Sint16 *) cvt->buf;
2178 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2179 const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f));
2180 *dst = ((Sint16) SDL_SwapBE16(val));
2181 }
2182
2183 cvt->len_cvt /= 2;
2184 format = AUDIO_S16MSB;
2185 if (cvt->filters[++cvt->filter_index]) {
2186 cvt->filters[cvt->filter_index] (cvt, format);
2187 }
2188 }
2189
2190 static void SDLCALL
2191 SDL_Convert_F32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2192 {
2193 int i;
2194 const float *src;
2195 Sint32 *dst;
2196
2197 #ifdef DEBUG_CONVERT
2198 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32LSB.\n");
2199 #endif
2200
2201 src = (const float *) cvt->buf;
2202 dst = (Sint32 *) cvt->buf;
2203 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2204 const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0));
2205 *dst = ((Sint32) SDL_SwapLE32(val));
2206 }
2207
2208 format = AUDIO_S32LSB;
2209 if (cvt->filters[++cvt->filter_index]) {
2210 cvt->filters[cvt->filter_index] (cvt, format);
2211 }
2212 }
2213
2214 static void SDLCALL
2215 SDL_Convert_F32MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2216 {
2217 int i;
2218 const float *src;
2219 Sint32 *dst;
2220
2221 #ifdef DEBUG_CONVERT
2222 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32MSB.\n");
2223 #endif
2224
2225 src = (const float *) cvt->buf;
2226 dst = (Sint32 *) cvt->buf;
2227 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2228 const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0));
2229 *dst = ((Sint32) SDL_SwapBE32(val));
2230 }
2231
2232 format = AUDIO_S32MSB;
2233 if (cvt->filters[++cvt->filter_index]) {
2234 cvt->filters[cvt->filter_index] (cvt, format);
2235 }
2236 }
2237
2238 static void SDLCALL
2239 SDL_Convert_F32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format)
2240 {
2241 int i;
2242 const float *src;
2243 float *dst;
2244
2245 #ifdef DEBUG_CONVERT
2246 fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_F32LSB.\n");
2247 #endif
2248
2249 src = (const float *) cvt->buf;
2250 dst = (float *) cvt->buf;
2251 for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) {
2252 const float val = SDL_SwapFloatBE(*src);
2253 *dst = SDL_SwapFloatLE(val);
2254 }
2255
2256 format = AUDIO_F32LSB;
2257 if (cvt->filters[++cvt->filter_index]) {
2258 cvt->filters[cvt->filter_index] (cvt, format);
2259 }
2260 }
2261
2262 const SDL_AudioTypeFilters sdl_audio_type_filters[] =
2263 {
2264 { AUDIO_U8, AUDIO_S8, SDL_Convert_U8_to_S8 },
2265 { AUDIO_U8, AUDIO_U16LSB, SDL_Convert_U8_to_U16LSB },
2266 { AUDIO_U8, AUDIO_S16LSB, SDL_Convert_U8_to_S16LSB },
2267 { AUDIO_U8, AUDIO_U16MSB, SDL_Convert_U8_to_U16MSB },
2268 { AUDIO_U8, AUDIO_S16MSB, SDL_Convert_U8_to_S16MSB },
2269 { AUDIO_U8, AUDIO_S32LSB, SDL_Convert_U8_to_S32LSB },
2270 { AUDIO_U8, AUDIO_S32MSB, SDL_Convert_U8_to_S32MSB },
2271 { AUDIO_U8, AUDIO_F32LSB, SDL_Convert_U8_to_F32LSB },
2272 { AUDIO_U8, AUDIO_F32MSB, SDL_Convert_U8_to_F32MSB },
2273 { AUDIO_S8, AUDIO_U8, SDL_Convert_S8_to_U8 },
2274 { AUDIO_S8, AUDIO_U16LSB, SDL_Convert_S8_to_U16LSB },
2275 { AUDIO_S8, AUDIO_S16LSB, SDL_Convert_S8_to_S16LSB },
2276 { AUDIO_S8, AUDIO_U16MSB, SDL_Convert_S8_to_U16MSB },
2277 { AUDIO_S8, AUDIO_S16MSB, SDL_Convert_S8_to_S16MSB },
2278 { AUDIO_S8, AUDIO_S32LSB, SDL_Convert_S8_to_S32LSB },
2279 { AUDIO_S8, AUDIO_S32MSB, SDL_Convert_S8_to_S32MSB },
2280 { AUDIO_S8, AUDIO_F32LSB, SDL_Convert_S8_to_F32LSB },
2281 { AUDIO_S8, AUDIO_F32MSB, SDL_Convert_S8_to_F32MSB },
2282 { AUDIO_U16LSB, AUDIO_U8, SDL_Convert_U16LSB_to_U8 },
2283 { AUDIO_U16LSB, AUDIO_S8, SDL_Convert_U16LSB_to_S8 },
2284 { AUDIO_U16LSB, AUDIO_S16LSB, SDL_Convert_U16LSB_to_S16LSB },
2285 { AUDIO_U16LSB, AUDIO_U16MSB, SDL_Convert_U16LSB_to_U16MSB },
2286 { AUDIO_U16LSB, AUDIO_S16MSB, SDL_Convert_U16LSB_to_S16MSB },
2287 { AUDIO_U16LSB, AUDIO_S32LSB, SDL_Convert_U16LSB_to_S32LSB },
2288 { AUDIO_U16LSB, AUDIO_S32MSB, SDL_Convert_U16LSB_to_S32MSB },
2289 { AUDIO_U16LSB, AUDIO_F32LSB, SDL_Convert_U16LSB_to_F32LSB },
2290 { AUDIO_U16LSB, AUDIO_F32MSB, SDL_Convert_U16LSB_to_F32MSB },
2291 { AUDIO_S16LSB, AUDIO_U8, SDL_Convert_S16LSB_to_U8 },
2292 { AUDIO_S16LSB, AUDIO_S8, SDL_Convert_S16LSB_to_S8 },
2293 { AUDIO_S16LSB, AUDIO_U16LSB, SDL_Convert_S16LSB_to_U16LSB },
2294 { AUDIO_S16LSB, AUDIO_U16MSB, SDL_Convert_S16LSB_to_U16MSB },
2295 { AUDIO_S16LSB, AUDIO_S16MSB, SDL_Convert_S16LSB_to_S16MSB },
2296 { AUDIO_S16LSB, AUDIO_S32LSB, SDL_Convert_S16LSB_to_S32LSB },
2297 { AUDIO_S16LSB, AUDIO_S32MSB, SDL_Convert_S16LSB_to_S32MSB },
2298 { AUDIO_S16LSB, AUDIO_F32LSB, SDL_Convert_S16LSB_to_F32LSB },
2299 { AUDIO_S16LSB, AUDIO_F32MSB, SDL_Convert_S16LSB_to_F32MSB },
2300 { AUDIO_U16MSB, AUDIO_U8, SDL_Convert_U16MSB_to_U8 },
2301 { AUDIO_U16MSB, AUDIO_S8, SDL_Convert_U16MSB_to_S8 },
2302 { AUDIO_U16MSB, AUDIO_U16LSB, SDL_Convert_U16MSB_to_U16LSB },
2303 { AUDIO_U16MSB, AUDIO_S16LSB, SDL_Convert_U16MSB_to_S16LSB },
2304 { AUDIO_U16MSB, AUDIO_S16MSB, SDL_Convert_U16MSB_to_S16MSB },
2305 { AUDIO_U16MSB, AUDIO_S32LSB, SDL_Convert_U16MSB_to_S32LSB },
2306 { AUDIO_U16MSB, AUDIO_S32MSB, SDL_Convert_U16MSB_to_S32MSB },
2307 { AUDIO_U16MSB, AUDIO_F32LSB, SDL_Convert_U16MSB_to_F32LSB },
2308 { AUDIO_U16MSB, AUDIO_F32MSB, SDL_Convert_U16MSB_to_F32MSB },
2309 { AUDIO_S16MSB, AUDIO_U8, SDL_Convert_S16MSB_to_U8 },
2310 { AUDIO_S16MSB, AUDIO_S8, SDL_Convert_S16MSB_to_S8 },
2311 { AUDIO_S16MSB, AUDIO_U16LSB, SDL_Convert_S16MSB_to_U16LSB },
2312 { AUDIO_S16MSB, AUDIO_S16LSB, SDL_Convert_S16MSB_to_S16LSB },
2313 { AUDIO_S16MSB, AUDIO_U16MSB, SDL_Convert_S16MSB_to_U16MSB },
2314 { AUDIO_S16MSB, AUDIO_S32LSB, SDL_Convert_S16MSB_to_S32LSB },
2315 { AUDIO_S16MSB, AUDIO_S32MSB, SDL_Convert_S16MSB_to_S32MSB },
2316 { AUDIO_S16MSB, AUDIO_F32LSB, SDL_Convert_S16MSB_to_F32LSB },
2317 { AUDIO_S16MSB, AUDIO_F32MSB, SDL_Convert_S16MSB_to_F32MSB },
2318 { AUDIO_S32LSB, AUDIO_U8, SDL_Convert_S32LSB_to_U8 },
2319 { AUDIO_S32LSB, AUDIO_S8, SDL_Convert_S32LSB_to_S8 },
2320 { AUDIO_S32LSB, AUDIO_U16LSB, SDL_Convert_S32LSB_to_U16LSB },
2321 { AUDIO_S32LSB, AUDIO_S16LSB, SDL_Convert_S32LSB_to_S16LSB },
2322 { AUDIO_S32LSB, AUDIO_U16MSB, SDL_Convert_S32LSB_to_U16MSB },
2323 { AUDIO_S32LSB, AUDIO_S16MSB, SDL_Convert_S32LSB_to_S16MSB },
2324 { AUDIO_S32LSB, AUDIO_S32MSB, SDL_Convert_S32LSB_to_S32MSB },
2325 { AUDIO_S32LSB, AUDIO_F32LSB, SDL_Convert_S32LSB_to_F32LSB },
2326 { AUDIO_S32LSB, AUDIO_F32MSB, SDL_Convert_S32LSB_to_F32MSB },
2327 { AUDIO_S32MSB, AUDIO_U8, SDL_Convert_S32MSB_to_U8 },
2328 { AUDIO_S32MSB, AUDIO_S8, SDL_Convert_S32MSB_to_S8 },
2329 { AUDIO_S32MSB, AUDIO_U16LSB, SDL_Convert_S32MSB_to_U16LSB },
2330 { AUDIO_S32MSB, AUDIO_S16LSB, SDL_Convert_S32MSB_to_S16LSB },
2331 { AUDIO_S32MSB, AUDIO_U16MSB, SDL_Convert_S32MSB_to_U16MSB },
2332 { AUDIO_S32MSB, AUDIO_S16MSB, SDL_Convert_S32MSB_to_S16MSB },
2333 { AUDIO_S32MSB, AUDIO_S32LSB, SDL_Convert_S32MSB_to_S32LSB },
2334 { AUDIO_S32MSB, AUDIO_F32LSB, SDL_Convert_S32MSB_to_F32LSB },
2335 { AUDIO_S32MSB, AUDIO_F32MSB, SDL_Convert_S32MSB_to_F32MSB },
2336 { AUDIO_F32LSB, AUDIO_U8, SDL_Convert_F32LSB_to_U8 },
2337 { AUDIO_F32LSB, AUDIO_S8, SDL_Convert_F32LSB_to_S8 },
2338 { AUDIO_F32LSB, AUDIO_U16LSB, SDL_Convert_F32LSB_to_U16LSB },
2339 { AUDIO_F32LSB, AUDIO_S16LSB, SDL_Convert_F32LSB_to_S16LSB },
2340 { AUDIO_F32LSB, AUDIO_U16MSB, SDL_Convert_F32LSB_to_U16MSB },
2341 { AUDIO_F32LSB, AUDIO_S16MSB, SDL_Convert_F32LSB_to_S16MSB },
2342 { AUDIO_F32LSB, AUDIO_S32LSB, SDL_Convert_F32LSB_to_S32LSB },
2343 { AUDIO_F32LSB, AUDIO_S32MSB, SDL_Convert_F32LSB_to_S32MSB },
2344 { AUDIO_F32LSB, AUDIO_F32MSB, SDL_Convert_F32LSB_to_F32MSB },
2345 { AUDIO_F32MSB, AUDIO_U8, SDL_Convert_F32MSB_to_U8 },
2346 { AUDIO_F32MSB, AUDIO_S8, SDL_Convert_F32MSB_to_S8 },
2347 { AUDIO_F32MSB, AUDIO_U16LSB, SDL_Convert_F32MSB_to_U16LSB },
2348 { AUDIO_F32MSB, AUDIO_S16LSB, SDL_Convert_F32MSB_to_S16LSB },
2349 { AUDIO_F32MSB, AUDIO_U16MSB, SDL_Convert_F32MSB_to_U16MSB },
2350 { AUDIO_F32MSB, AUDIO_S16MSB, SDL_Convert_F32MSB_to_S16MSB },
2351 { AUDIO_F32MSB, AUDIO_S32LSB, SDL_Convert_F32MSB_to_S32LSB },
2352 { AUDIO_F32MSB, AUDIO_S32MSB, SDL_Convert_F32MSB_to_S32MSB },
2353 { AUDIO_F32MSB, AUDIO_F32LSB, SDL_Convert_F32MSB_to_F32LSB },
2354 };
2355
2356