Mercurial > sdl-ios-xcode
annotate docs/html/sdlaudiocvt.html @ 584:365ed14a882a
*** empty log message ***
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 01 Feb 2003 19:27:05 +0000 |
parents | e5bc29de3f0a |
children | 355632dca928 |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_AudioCVT</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.64 |
0 | 8 "><LINK |
9 REL="HOME" | |
10 TITLE="SDL Library Documentation" | |
11 HREF="index.html"><LINK | |
12 REL="UP" | |
13 TITLE="Audio" | |
14 HREF="audio.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_FreeWAV" | |
17 HREF="sdlfreewav.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_BuildAudioCVT" | |
20 HREF="sdlbuildaudiocvt.html"></HEAD | |
21 ><BODY | |
22 CLASS="REFENTRY" | |
23 BGCOLOR="#FFF8DC" | |
24 TEXT="#000000" | |
25 LINK="#0000ee" | |
26 VLINK="#551a8b" | |
27 ALINK="#ff0000" | |
28 ><DIV | |
29 CLASS="NAVHEADER" | |
30 ><TABLE | |
31 WIDTH="100%" | |
32 BORDER="0" | |
33 CELLPADDING="0" | |
34 CELLSPACING="0" | |
35 ><TR | |
36 ><TH | |
37 COLSPAN="3" | |
38 ALIGN="center" | |
39 >SDL Library Documentation</TH | |
40 ></TR | |
41 ><TR | |
42 ><TD | |
43 WIDTH="10%" | |
44 ALIGN="left" | |
45 VALIGN="bottom" | |
46 ><A | |
47 HREF="sdlfreewav.html" | |
48 >Prev</A | |
49 ></TD | |
50 ><TD | |
51 WIDTH="80%" | |
52 ALIGN="center" | |
53 VALIGN="bottom" | |
54 ></TD | |
55 ><TD | |
56 WIDTH="10%" | |
57 ALIGN="right" | |
58 VALIGN="bottom" | |
59 ><A | |
60 HREF="sdlbuildaudiocvt.html" | |
61 >Next</A | |
62 ></TD | |
63 ></TR | |
64 ></TABLE | |
65 ><HR | |
66 ALIGN="LEFT" | |
67 WIDTH="100%"></DIV | |
68 ><H1 | |
69 ><A | |
70 NAME="SDLAUDIOCVT" | |
71 >SDL_AudioCVT</A | |
72 ></H1 | |
73 ><DIV | |
74 CLASS="REFNAMEDIV" | |
75 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
76 NAME="AEN6496" |
0 | 77 ></A |
78 ><H2 | |
79 >Name</H2 | |
80 >SDL_AudioCVT -- Audio Conversion Structure</DIV | |
81 ><DIV | |
82 CLASS="REFSECT1" | |
83 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
84 NAME="AEN6499" |
0 | 85 ></A |
86 ><H2 | |
87 >Structure Definition</H2 | |
88 ><PRE | |
89 CLASS="PROGRAMLISTING" | |
90 >typedef struct{ | |
91 int needed; | |
92 Uint16 src_format; | |
93 Uint16 dest_format; | |
94 double rate_incr; | |
95 Uint8 *buf; | |
96 int len; | |
97 int len_cvt; | |
98 int len_mult; | |
99 double len_ratio; | |
100 void (*filters[10])(struct SDL_AudioCVT *cvt, Uint16 format); | |
101 int filter_index; | |
102 } SDL_AudioCVT;</PRE | |
103 ></DIV | |
104 ><DIV | |
105 CLASS="REFSECT1" | |
106 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
107 NAME="AEN6502" |
0 | 108 ></A |
109 ><H2 | |
110 >Structure Data</H2 | |
111 ><DIV | |
112 CLASS="INFORMALTABLE" | |
113 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
114 NAME="AEN6504" |
0 | 115 ></A |
116 ><P | |
117 ></P | |
118 ><TABLE | |
119 BORDER="0" | |
120 CLASS="CALSTABLE" | |
121 ><TBODY | |
122 ><TR | |
123 ><TD | |
124 ALIGN="LEFT" | |
125 VALIGN="TOP" | |
126 ><TT | |
127 CLASS="STRUCTFIELD" | |
128 ><I | |
129 >needed</I | |
130 ></TT | |
131 ></TD | |
132 ><TD | |
133 ALIGN="LEFT" | |
134 VALIGN="TOP" | |
135 >Set to one if the conversion is possible</TD | |
136 ></TR | |
137 ><TR | |
138 ><TD | |
139 ALIGN="LEFT" | |
140 VALIGN="TOP" | |
141 ><TT | |
142 CLASS="STRUCTFIELD" | |
143 ><I | |
144 >src_format</I | |
145 ></TT | |
146 ></TD | |
147 ><TD | |
148 ALIGN="LEFT" | |
149 VALIGN="TOP" | |
150 >Audio format of the source</TD | |
151 ></TR | |
152 ><TR | |
153 ><TD | |
154 ALIGN="LEFT" | |
155 VALIGN="TOP" | |
156 ><TT | |
157 CLASS="STRUCTFIELD" | |
158 ><I | |
159 >dest_format</I | |
160 ></TT | |
161 ></TD | |
162 ><TD | |
163 ALIGN="LEFT" | |
164 VALIGN="TOP" | |
165 >Audio format of the destination</TD | |
166 ></TR | |
167 ><TR | |
168 ><TD | |
169 ALIGN="LEFT" | |
170 VALIGN="TOP" | |
171 ><TT | |
172 CLASS="STRUCTFIELD" | |
173 ><I | |
174 >rate_incr</I | |
175 ></TT | |
176 ></TD | |
177 ><TD | |
178 ALIGN="LEFT" | |
179 VALIGN="TOP" | |
180 >Rate conversion increment</TD | |
181 ></TR | |
182 ><TR | |
183 ><TD | |
184 ALIGN="LEFT" | |
185 VALIGN="TOP" | |
186 ><TT | |
187 CLASS="STRUCTFIELD" | |
188 ><I | |
189 >buf</I | |
190 ></TT | |
191 ></TD | |
192 ><TD | |
193 ALIGN="LEFT" | |
194 VALIGN="TOP" | |
195 >Audio buffer</TD | |
196 ></TR | |
197 ><TR | |
198 ><TD | |
199 ALIGN="LEFT" | |
200 VALIGN="TOP" | |
201 ><TT | |
202 CLASS="STRUCTFIELD" | |
203 ><I | |
204 >len</I | |
205 ></TT | |
206 ></TD | |
207 ><TD | |
208 ALIGN="LEFT" | |
209 VALIGN="TOP" | |
210 >Length of the original audio buffer in bytes</TD | |
211 ></TR | |
212 ><TR | |
213 ><TD | |
214 ALIGN="LEFT" | |
215 VALIGN="TOP" | |
216 ><TT | |
217 CLASS="STRUCTFIELD" | |
218 ><I | |
219 >len_cvt</I | |
220 ></TT | |
221 ></TD | |
222 ><TD | |
223 ALIGN="LEFT" | |
224 VALIGN="TOP" | |
225 >Length of converted audio buffer in bytes (calculated)</TD | |
226 ></TR | |
227 ><TR | |
228 ><TD | |
229 ALIGN="LEFT" | |
230 VALIGN="TOP" | |
231 ><TT | |
232 CLASS="STRUCTFIELD" | |
233 ><I | |
234 >len_mult</I | |
235 ></TT | |
236 ></TD | |
237 ><TD | |
238 ALIGN="LEFT" | |
239 VALIGN="TOP" | |
240 ><TT | |
241 CLASS="STRUCTFIELD" | |
242 ><I | |
243 >buf</I | |
244 ></TT | |
245 > must be <TT | |
246 CLASS="STRUCTFIELD" | |
247 ><I | |
248 >len</I | |
249 ></TT | |
250 >*<TT | |
251 CLASS="STRUCTFIELD" | |
252 ><I | |
253 >len_mult</I | |
254 ></TT | |
255 > bytes in size(calculated)</TD | |
256 ></TR | |
257 ><TR | |
258 ><TD | |
259 ALIGN="LEFT" | |
260 VALIGN="TOP" | |
261 ><TT | |
262 CLASS="STRUCTFIELD" | |
263 ><I | |
264 >len_ratio</I | |
265 ></TT | |
266 ></TD | |
267 ><TD | |
268 ALIGN="LEFT" | |
269 VALIGN="TOP" | |
270 >Final audio size is <TT | |
271 CLASS="STRUCTFIELD" | |
272 ><I | |
273 >len</I | |
274 ></TT | |
275 >*<TT | |
276 CLASS="STRUCTFIELD" | |
277 ><I | |
278 >len_ratio</I | |
279 ></TT | |
280 ></TD | |
281 ></TR | |
282 ><TR | |
283 ><TD | |
284 ALIGN="LEFT" | |
285 VALIGN="TOP" | |
286 ><TT | |
287 CLASS="STRUCTFIELD" | |
288 ><I | |
289 >filters[10](..)</I | |
290 ></TT | |
291 ></TD | |
292 ><TD | |
293 ALIGN="LEFT" | |
294 VALIGN="TOP" | |
295 >Pointers to functions needed for this conversion</TD | |
296 ></TR | |
297 ><TR | |
298 ><TD | |
299 ALIGN="LEFT" | |
300 VALIGN="TOP" | |
301 ><TT | |
302 CLASS="STRUCTFIELD" | |
303 ><I | |
304 >filter_index</I | |
305 ></TT | |
306 ></TD | |
307 ><TD | |
308 ALIGN="LEFT" | |
309 VALIGN="TOP" | |
310 >Current conversion function</TD | |
311 ></TR | |
312 ></TBODY | |
313 ></TABLE | |
314 ><P | |
315 ></P | |
316 ></DIV | |
317 ></DIV | |
318 ><DIV | |
319 CLASS="REFSECT1" | |
320 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
321 NAME="AEN6556" |
0 | 322 ></A |
323 ><H2 | |
324 >Description</H2 | |
325 ><P | |
326 >The <SPAN | |
327 CLASS="STRUCTNAME" | |
328 >SDL_AudioCVT</SPAN | |
329 > is used to convert audio data between different formats. A <SPAN | |
330 CLASS="STRUCTNAME" | |
331 >SDL_AudioCVT</SPAN | |
332 > structure is created with the <A | |
333 HREF="sdlbuildaudiocvt.html" | |
334 ><TT | |
335 CLASS="FUNCTION" | |
336 >SDL_BuildAudioCVT</TT | |
337 ></A | |
338 > function, while the actual conversion is done by the <A | |
339 HREF="sdlconvertaudio.html" | |
340 ><TT | |
341 CLASS="FUNCTION" | |
342 >SDL_ConvertAudio</TT | |
343 ></A | |
344 > function.</P | |
345 ><P | |
346 >Many of the fields in the <SPAN | |
347 CLASS="STRUCTNAME" | |
348 >SDL_AudioCVT</SPAN | |
349 > structure should be considered private and their function will not be discussed here.</P | |
350 ><P | |
351 ></P | |
352 ><DIV | |
353 CLASS="VARIABLELIST" | |
354 ><DL | |
355 ><DT | |
356 ><SPAN | |
357 CLASS="TYPE" | |
358 >Uint8 *</SPAN | |
359 ><TT | |
360 CLASS="STRUCTFIELD" | |
361 ><I | |
362 >buf</I | |
363 ></TT | |
364 ></DT | |
365 ><DD | |
366 ><P | |
367 >This points to the audio data that will be used in the conversion. It is both the source and the destination, which means the converted audio data overwrites the original data. It also means that the converted data may be larger than the original data (if you were converting from 8-bit to 16-bit, for instance), so you must ensure <TT | |
368 CLASS="STRUCTFIELD" | |
369 ><I | |
370 >buf</I | |
371 ></TT | |
372 > is large enough. See below.</P | |
373 ></DD | |
374 ><DT | |
375 ><SPAN | |
376 CLASS="TYPE" | |
377 >int</SPAN | |
378 > <TT | |
379 CLASS="STRUCTFIELD" | |
380 ><I | |
381 >len</I | |
382 ></TT | |
383 ></DT | |
384 ><DD | |
385 ><P | |
386 >This is the length of the original audio data in bytes.</P | |
387 ></DD | |
388 ><DT | |
389 ><SPAN | |
390 CLASS="TYPE" | |
391 >int</SPAN | |
392 > <TT | |
393 CLASS="STRUCTFIELD" | |
394 ><I | |
395 >len_mult</I | |
396 ></TT | |
397 ></DT | |
398 ><DD | |
399 ><P | |
400 >As explained above, the audio buffer needs to be big enough to store the converted data, which may be bigger than the original audio data. The length of <TT | |
401 CLASS="STRUCTFIELD" | |
402 ><I | |
403 >buf</I | |
404 ></TT | |
405 > should be <TT | |
406 CLASS="STRUCTFIELD" | |
407 ><I | |
408 >len</I | |
409 ></TT | |
410 >*<TT | |
411 CLASS="STRUCTFIELD" | |
412 ><I | |
413 >len_mult</I | |
414 ></TT | |
415 >.</P | |
416 ></DD | |
417 ><DT | |
418 ><SPAN | |
419 CLASS="TYPE" | |
420 >double</SPAN | |
421 > <TT | |
422 CLASS="STRUCTFIELD" | |
423 ><I | |
424 >len_ratio</I | |
425 ></TT | |
426 ></DT | |
427 ><DD | |
428 ><P | |
429 >When you have finished converting your audio data, you need to know how much of your audio buffer is valid. <TT | |
430 CLASS="STRUCTFIELD" | |
431 ><I | |
432 >len</I | |
433 ></TT | |
434 >*<TT | |
435 CLASS="STRUCTFIELD" | |
436 ><I | |
437 >len_ratio</I | |
438 ></TT | |
439 > is the size of the converted audio data in bytes. This is very similar to <TT | |
440 CLASS="STRUCTFIELD" | |
441 ><I | |
442 >len_mult</I | |
443 ></TT | |
444 >, however when the convert audio data is shorter than the original <TT | |
445 CLASS="STRUCTFIELD" | |
446 ><I | |
447 >len_mult</I | |
448 ></TT | |
449 > would be 1. <TT | |
450 CLASS="STRUCTFIELD" | |
451 ><I | |
452 >len_ratio</I | |
453 ></TT | |
454 >, on the other hand, would be a fractional number between 0 and 1.</P | |
455 ></DD | |
456 ></DL | |
457 ></DIV | |
458 ></DIV | |
459 ><DIV | |
460 CLASS="REFSECT1" | |
461 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
462 NAME="AEN6601" |
0 | 463 ></A |
464 ><H2 | |
465 >See Also</H2 | |
466 ><P | |
467 ><A | |
468 HREF="sdlbuildaudiocvt.html" | |
469 ><TT | |
470 CLASS="FUNCTION" | |
471 >SDL_BuildAudioCVT</TT | |
472 ></A | |
473 >, | |
474 <A | |
475 HREF="sdlconvertaudio.html" | |
476 ><TT | |
477 CLASS="FUNCTION" | |
478 >SDL_ConvertAudio</TT | |
479 ></A | |
480 >, | |
481 <A | |
482 HREF="sdlaudiospec.html" | |
483 ><SPAN | |
484 CLASS="STRUCTNAME" | |
485 >SDL_AudioSpec</SPAN | |
486 ></A | |
487 ></P | |
488 ></DIV | |
489 ><DIV | |
490 CLASS="NAVFOOTER" | |
491 ><HR | |
492 ALIGN="LEFT" | |
493 WIDTH="100%"><TABLE | |
494 WIDTH="100%" | |
495 BORDER="0" | |
496 CELLPADDING="0" | |
497 CELLSPACING="0" | |
498 ><TR | |
499 ><TD | |
500 WIDTH="33%" | |
501 ALIGN="left" | |
502 VALIGN="top" | |
503 ><A | |
504 HREF="sdlfreewav.html" | |
505 >Prev</A | |
506 ></TD | |
507 ><TD | |
508 WIDTH="34%" | |
509 ALIGN="center" | |
510 VALIGN="top" | |
511 ><A | |
512 HREF="index.html" | |
513 >Home</A | |
514 ></TD | |
515 ><TD | |
516 WIDTH="33%" | |
517 ALIGN="right" | |
518 VALIGN="top" | |
519 ><A | |
520 HREF="sdlbuildaudiocvt.html" | |
521 >Next</A | |
522 ></TD | |
523 ></TR | |
524 ><TR | |
525 ><TD | |
526 WIDTH="33%" | |
527 ALIGN="left" | |
528 VALIGN="top" | |
529 >SDL_FreeWAV</TD | |
530 ><TD | |
531 WIDTH="34%" | |
532 ALIGN="center" | |
533 VALIGN="top" | |
534 ><A | |
535 HREF="audio.html" | |
536 >Up</A | |
537 ></TD | |
538 ><TD | |
539 WIDTH="33%" | |
540 ALIGN="right" | |
541 VALIGN="top" | |
542 >SDL_BuildAudioCVT</TD | |
543 ></TR | |
544 ></TABLE | |
545 ></DIV | |
546 ></BODY | |
547 ></HTML | |
548 > |