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