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