Mercurial > SDL_sound_CoreAudio
comparison audio_convert.c @ 342:fbbb1f25b944
Cleanups by Torbj�rn.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Wed, 22 May 2002 09:27:54 +0000 |
parents | 907e3776d2f4 |
children | ce998ee6194f |
comparison
equal
deleted
inserted
replaced
341:3466dde3a846 | 342:fbbb1f25b944 |
---|---|
43 /* | 43 /* |
44 * Toggle endianness. This filter is, of course, only applied to 16-bit | 44 * Toggle endianness. This filter is, of course, only applied to 16-bit |
45 * audio data. | 45 * audio data. |
46 */ | 46 */ |
47 | 47 |
48 void Sound_ConvertEndian(Sound_AudioCVT *cvt, Uint16 *format) | 48 static void Sound_ConvertEndian(Sound_AudioCVT *cvt, Uint16 *format) |
49 { | 49 { |
50 int i; | 50 int i; |
51 Uint8 *data, tmp; | 51 Uint8 *data, tmp; |
52 | 52 |
53 /* SNDDBG(("Converting audio endianness\n")); */ | 53 /* SNDDBG(("Converting audio endianness\n")); */ |
69 /* | 69 /* |
70 * Toggle signed/unsigned. Apparently this is done by toggling the most | 70 * Toggle signed/unsigned. Apparently this is done by toggling the most |
71 * significant bit of each sample. | 71 * significant bit of each sample. |
72 */ | 72 */ |
73 | 73 |
74 void Sound_ConvertSign(Sound_AudioCVT *cvt, Uint16 *format) | 74 static void Sound_ConvertSign(Sound_AudioCVT *cvt, Uint16 *format) |
75 { | 75 { |
76 int i; | 76 int i; |
77 Uint8 *data; | 77 Uint8 *data; |
78 | 78 |
79 /* SNDDBG(("Converting audio signedness\n")); */ | 79 /* SNDDBG(("Converting audio signedness\n")); */ |
106 /* | 106 /* |
107 * Convert 16-bit to 8-bit. This is done by taking the most significant byte | 107 * Convert 16-bit to 8-bit. This is done by taking the most significant byte |
108 * of each 16-bit sample. | 108 * of each 16-bit sample. |
109 */ | 109 */ |
110 | 110 |
111 void Sound_Convert8(Sound_AudioCVT *cvt, Uint16 *format) | 111 static void Sound_Convert8(Sound_AudioCVT *cvt, Uint16 *format) |
112 { | 112 { |
113 int i; | 113 int i; |
114 Uint8 *src, *dst; | 114 Uint8 *src, *dst; |
115 | 115 |
116 /* SNDDBG(("Converting to 8-bit\n")); */ | 116 /* SNDDBG(("Converting to 8-bit\n")); */ |
134 } /* Sound_Convert8 */ | 134 } /* Sound_Convert8 */ |
135 | 135 |
136 | 136 |
137 /* Convert 8-bit to 16-bit - LSB */ | 137 /* Convert 8-bit to 16-bit - LSB */ |
138 | 138 |
139 void Sound_Convert16LSB(Sound_AudioCVT *cvt, Uint16 *format) | 139 static void Sound_Convert16LSB(Sound_AudioCVT *cvt, Uint16 *format) |
140 { | 140 { |
141 int i; | 141 int i; |
142 Uint8 *src, *dst; | 142 Uint8 *src, *dst; |
143 | 143 |
144 /* SNDDBG(("Converting to 16-bit LSB\n")); */ | 144 /* SNDDBG(("Converting to 16-bit LSB\n")); */ |
159 } /* Sound_Convert16LSB */ | 159 } /* Sound_Convert16LSB */ |
160 | 160 |
161 | 161 |
162 /* Convert 8-bit to 16-bit - MSB */ | 162 /* Convert 8-bit to 16-bit - MSB */ |
163 | 163 |
164 void Sound_Convert16MSB(Sound_AudioCVT *cvt, Uint16 *format) | 164 static void Sound_Convert16MSB(Sound_AudioCVT *cvt, Uint16 *format) |
165 { | 165 { |
166 int i; | 166 int i; |
167 Uint8 *src, *dst; | 167 Uint8 *src, *dst; |
168 | 168 |
169 /* SNDDBG(("Converting to 16-bit MSB\n")); */ | 169 /* SNDDBG(("Converting to 16-bit MSB\n")); */ |
184 } /* Sound_Convert16MSB */ | 184 } /* Sound_Convert16MSB */ |
185 | 185 |
186 | 186 |
187 /* Duplicate a mono channel to both stereo channels */ | 187 /* Duplicate a mono channel to both stereo channels */ |
188 | 188 |
189 void Sound_ConvertStereo(Sound_AudioCVT *cvt, Uint16 *format) | 189 static void Sound_ConvertStereo(Sound_AudioCVT *cvt, Uint16 *format) |
190 { | 190 { |
191 int i; | 191 int i; |
192 | 192 |
193 /* SNDDBG(("Converting to stereo\n")); */ | 193 /* SNDDBG(("Converting to stereo\n")); */ |
194 | 194 |
228 } /* Sound_ConvertStereo */ | 228 } /* Sound_ConvertStereo */ |
229 | 229 |
230 | 230 |
231 /* Effectively mix right and left channels into a single channel */ | 231 /* Effectively mix right and left channels into a single channel */ |
232 | 232 |
233 void Sound_ConvertMono(Sound_AudioCVT *cvt, Uint16 *format) | 233 static void Sound_ConvertMono(Sound_AudioCVT *cvt, Uint16 *format) |
234 { | 234 { |
235 int i; | 235 int i; |
236 Sint32 sample; | 236 Sint32 sample; |
237 Uint8 *u_src, *u_dst; | 237 Uint8 *u_src, *u_dst; |
238 Sint8 *s_src, *s_dst; | 238 Sint8 *s_src, *s_dst; |
384 } /* Sound_ConvertMono */ | 384 } /* Sound_ConvertMono */ |
385 | 385 |
386 | 386 |
387 /* Convert rate up by multiple of 2 */ | 387 /* Convert rate up by multiple of 2 */ |
388 | 388 |
389 void Sound_RateMUL2(Sound_AudioCVT *cvt, Uint16 *format) | 389 static void Sound_RateMUL2(Sound_AudioCVT *cvt, Uint16 *format) |
390 { | 390 { |
391 int i; | 391 int i; |
392 Uint8 *src, *dst; | 392 Uint8 *src, *dst; |
393 | 393 |
394 /* SNDDBG(("Converting audio rate * 2\n")); */ | 394 /* SNDDBG(("Converting audio rate * 2\n")); */ |
426 } /* Sound_RateMUL2 */ | 426 } /* Sound_RateMUL2 */ |
427 | 427 |
428 | 428 |
429 /* Convert rate down by multiple of 2 */ | 429 /* Convert rate down by multiple of 2 */ |
430 | 430 |
431 void Sound_RateDIV2(Sound_AudioCVT *cvt, Uint16 *format) | 431 static void Sound_RateDIV2(Sound_AudioCVT *cvt, Uint16 *format) |
432 { | 432 { |
433 int i; | 433 int i; |
434 Uint8 *src, *dst; | 434 Uint8 *src, *dst; |
435 | 435 |
436 /* SNDDBG(("Converting audio rate / 2\n")); */ | 436 /* SNDDBG(("Converting audio rate / 2\n")); */ |
465 } /* Sound_RateDIV2 */ | 465 } /* Sound_RateDIV2 */ |
466 | 466 |
467 | 467 |
468 /* Very slow rate conversion routine */ | 468 /* Very slow rate conversion routine */ |
469 | 469 |
470 void Sound_RateSLOW(Sound_AudioCVT *cvt, Uint16 *format) | 470 static void Sound_RateSLOW(Sound_AudioCVT *cvt, Uint16 *format) |
471 { | 471 { |
472 double ipos; | 472 double ipos; |
473 int i, clen; | 473 int i, clen; |
474 Uint8 *output8; | 474 Uint8 *output8; |
475 Uint16 *output16; | 475 Uint16 *output16; |