comparison docs/html/sdlconvertaudio.html @ 803:355632dca928

Updated SDL HTML documentation
author Sam Lantinga <slouken@libsdl.org>
date Tue, 10 Feb 2004 15:15:40 +0000
parents e5bc29de3f0a
children
comparison
equal deleted inserted replaced
802:3c609d54f100 803:355632dca928
2 ><HEAD 2 ><HEAD
3 ><TITLE 3 ><TITLE
4 >SDL_ConvertAudio</TITLE 4 >SDL_ConvertAudio</TITLE
5 ><META 5 ><META
6 NAME="GENERATOR" 6 NAME="GENERATOR"
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.64 7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
8 "><LINK 8 "><LINK
9 REL="HOME" 9 REL="HOME"
10 TITLE="SDL Library Documentation" 10 TITLE="SDL Library Documentation"
11 HREF="index.html"><LINK 11 HREF="index.html"><LINK
12 REL="UP" 12 REL="UP"
26 VLINK="#551a8b" 26 VLINK="#551a8b"
27 ALINK="#ff0000" 27 ALINK="#ff0000"
28 ><DIV 28 ><DIV
29 CLASS="NAVHEADER" 29 CLASS="NAVHEADER"
30 ><TABLE 30 ><TABLE
31 SUMMARY="Header navigation table"
31 WIDTH="100%" 32 WIDTH="100%"
32 BORDER="0" 33 BORDER="0"
33 CELLPADDING="0" 34 CELLPADDING="0"
34 CELLSPACING="0" 35 CELLSPACING="0"
35 ><TR 36 ><TR
43 WIDTH="10%" 44 WIDTH="10%"
44 ALIGN="left" 45 ALIGN="left"
45 VALIGN="bottom" 46 VALIGN="bottom"
46 ><A 47 ><A
47 HREF="sdlbuildaudiocvt.html" 48 HREF="sdlbuildaudiocvt.html"
49 ACCESSKEY="P"
48 >Prev</A 50 >Prev</A
49 ></TD 51 ></TD
50 ><TD 52 ><TD
51 WIDTH="80%" 53 WIDTH="80%"
52 ALIGN="center" 54 ALIGN="center"
56 WIDTH="10%" 58 WIDTH="10%"
57 ALIGN="right" 59 ALIGN="right"
58 VALIGN="bottom" 60 VALIGN="bottom"
59 ><A 61 ><A
60 HREF="sdlmixaudio.html" 62 HREF="sdlmixaudio.html"
63 ACCESSKEY="N"
61 >Next</A 64 >Next</A
62 ></TD 65 ></TD
63 ></TR 66 ></TR
64 ></TABLE 67 ></TABLE
65 ><HR 68 ><HR
66 ALIGN="LEFT" 69 ALIGN="LEFT"
67 WIDTH="100%"></DIV 70 WIDTH="100%"></DIV
68 ><H1 71 ><H1
69 ><A 72 ><A
70 NAME="SDLCONVERTAUDIO" 73 NAME="SDLCONVERTAUDIO"
71 >SDL_ConvertAudio</A 74 ></A
72 ></H1 75 >SDL_ConvertAudio</H1
73 ><DIV 76 ><DIV
74 CLASS="REFNAMEDIV" 77 CLASS="REFNAMEDIV"
75 ><A 78 ><A
76 NAME="AEN6660" 79 NAME="AEN7048"
77 ></A 80 ></A
78 ><H2 81 ><H2
79 >Name</H2 82 >Name</H2
80 >SDL_ConvertAudio&nbsp;--&nbsp;Convert audio data to a desired audio format.</DIV 83 >SDL_ConvertAudio&nbsp;--&nbsp;Convert audio data to a desired audio format.</DIV
81 ><DIV 84 ><DIV
82 CLASS="REFSYNOPSISDIV" 85 CLASS="REFSYNOPSISDIV"
83 ><A 86 ><A
84 NAME="AEN6663" 87 NAME="AEN7051"
85 ></A 88 ></A
86 ><H2 89 ><H2
87 >Synopsis</H2 90 >Synopsis</H2
88 ><DIV 91 ><DIV
89 CLASS="FUNCSYNOPSIS" 92 CLASS="FUNCSYNOPSIS"
90 ><A 93 ><A
91 NAME="AEN6664" 94 NAME="AEN7052"
92 ></A 95 ></A
93 ><P 96 ><P
94 ></P 97 ></P
95 ><PRE 98 ><PRE
96 CLASS="FUNCSYNOPSISINFO" 99 CLASS="FUNCSYNOPSISINFO"
110 ></DIV 113 ></DIV
111 ></DIV 114 ></DIV
112 ><DIV 115 ><DIV
113 CLASS="REFSECT1" 116 CLASS="REFSECT1"
114 ><A 117 ><A
115 NAME="AEN6670" 118 NAME="AEN7058"
116 ></A 119 ></A
117 ><H2 120 ><H2
118 >Description</H2 121 >Description</H2
119 ><P 122 ><P
120 ><TT 123 ><TT
238 >.</P 241 >.</P
239 ></DIV 242 ></DIV
240 ><DIV 243 ><DIV
241 CLASS="REFSECT1" 244 CLASS="REFSECT1"
242 ><A 245 ><A
243 NAME="AEN6705" 246 NAME="AEN7093"
244 ></A 247 ></A
245 ><H2 248 ><H2
246 >Examples</H2 249 >Examples</H2
247 ><PRE 250 ><PRE
248 CLASS="PROGRAMLISTING" 251 CLASS="PROGRAMLISTING"
255 Uint32 wav_len; 258 Uint32 wav_len;
256 Uint8 *wav_buf; 259 Uint8 *wav_buf;
257 int ret; 260 int ret;
258 261
259 /* Allocated audio specs */ 262 /* Allocated audio specs */
260 desired=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec)); 263 desired = malloc(sizeof(SDL_AudioSpec));
261 obtained=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec)); 264 obtained = malloc(sizeof(SDL_AudioSpec));
262 265
263 /* Set desired format */ 266 /* Set desired format */
264 desired-&#62;freq=22050; 267 desired-&#62;freq=22050;
265 desired-&#62;format=AUDIO_S16LSB; 268 desired-&#62;format=AUDIO_S16LSB;
266 desired-&#62;samples=8192; 269 desired-&#62;samples=8192;
295 free(obtained); 298 free(obtained);
296 SDL_FreeWAV(wav_buf); 299 SDL_FreeWAV(wav_buf);
297 } 300 }
298 301
299 /* Setup for conversion */ 302 /* Setup for conversion */
300 wav_cvt.buf=(Uint8 *)malloc(wav_len*wav_cvt.len_mult); 303 wav_cvt.buf = malloc(wav_len * wav_cvt.len_mult);
301 wav_cvt.len=wav_len; 304 wav_cvt.len = wav_len;
302 memcpy(wav_cvt.buf, wav_buf, wav_len); 305 memcpy(wav_cvt.buf, wav_buf, wav_len);
303 306
304 /* We can delete to original WAV data now */ 307 /* We can delete to original WAV data now */
305 SDL_FreeWAV(wav_buf); 308 SDL_FreeWAV(wav_buf);
306 309
315 &#13;</PRE 318 &#13;</PRE
316 ></DIV 319 ></DIV
317 ><DIV 320 ><DIV
318 CLASS="REFSECT1" 321 CLASS="REFSECT1"
319 ><A 322 ><A
320 NAME="AEN6708" 323 NAME="AEN7096"
321 ></A 324 ></A
322 ><H2 325 ><H2
323 >See Also</H2 326 >See Also</H2
324 ><P 327 ><P
325 ><A 328 ><A
340 ><DIV 343 ><DIV
341 CLASS="NAVFOOTER" 344 CLASS="NAVFOOTER"
342 ><HR 345 ><HR
343 ALIGN="LEFT" 346 ALIGN="LEFT"
344 WIDTH="100%"><TABLE 347 WIDTH="100%"><TABLE
348 SUMMARY="Footer navigation table"
345 WIDTH="100%" 349 WIDTH="100%"
346 BORDER="0" 350 BORDER="0"
347 CELLPADDING="0" 351 CELLPADDING="0"
348 CELLSPACING="0" 352 CELLSPACING="0"
349 ><TR 353 ><TR
351 WIDTH="33%" 355 WIDTH="33%"
352 ALIGN="left" 356 ALIGN="left"
353 VALIGN="top" 357 VALIGN="top"
354 ><A 358 ><A
355 HREF="sdlbuildaudiocvt.html" 359 HREF="sdlbuildaudiocvt.html"
360 ACCESSKEY="P"
356 >Prev</A 361 >Prev</A
357 ></TD 362 ></TD
358 ><TD 363 ><TD
359 WIDTH="34%" 364 WIDTH="34%"
360 ALIGN="center" 365 ALIGN="center"
361 VALIGN="top" 366 VALIGN="top"
362 ><A 367 ><A
363 HREF="index.html" 368 HREF="index.html"
369 ACCESSKEY="H"
364 >Home</A 370 >Home</A
365 ></TD 371 ></TD
366 ><TD 372 ><TD
367 WIDTH="33%" 373 WIDTH="33%"
368 ALIGN="right" 374 ALIGN="right"
369 VALIGN="top" 375 VALIGN="top"
370 ><A 376 ><A
371 HREF="sdlmixaudio.html" 377 HREF="sdlmixaudio.html"
378 ACCESSKEY="N"
372 >Next</A 379 >Next</A
373 ></TD 380 ></TD
374 ></TR 381 ></TR
375 ><TR 382 ><TR
376 ><TD 383 ><TD
382 WIDTH="34%" 389 WIDTH="34%"
383 ALIGN="center" 390 ALIGN="center"
384 VALIGN="top" 391 VALIGN="top"
385 ><A 392 ><A
386 HREF="audio.html" 393 HREF="audio.html"
394 ACCESSKEY="U"
387 >Up</A 395 >Up</A
388 ></TD 396 ></TD
389 ><TD 397 ><TD
390 WIDTH="33%" 398 WIDTH="33%"
391 ALIGN="right" 399 ALIGN="right"