Mercurial > sdl-ios-xcode
annotate docs/html/sdlaudiospec.html @ 273:72acb06d3721
*** empty log message ***
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 22 Jan 2002 21:14:36 +0000 |
parents | e5bc29de3f0a |
children | 355632dca928 |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_AudioSpec</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="Audio" | |
17 HREF="audio.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_OpenAudio" | |
20 HREF="sdlopenaudio.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="audio.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="sdlopenaudio.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="SDLAUDIOSPEC" | |
71 >SDL_AudioSpec</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="AEN6119" |
0 | 77 ></A |
78 ><H2 | |
79 >Name</H2 | |
80 >SDL_AudioSpec -- Audio Specification 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="AEN6122" |
0 | 85 ></A |
86 ><H2 | |
87 >Structure Definition</H2 | |
88 ><PRE | |
89 CLASS="PROGRAMLISTING" | |
90 >typedef struct{ | |
91 int freq; | |
92 Uint16 format; | |
93 Uint8 channels; | |
94 Uint8 silence; | |
95 Uint16 samples; | |
96 Uint32 size; | |
97 void (*callback)(void *userdata, Uint8 *stream, int len); | |
98 void *userdata; | |
99 } SDL_AudioSpec;</PRE | |
100 ></DIV | |
101 ><DIV | |
102 CLASS="REFSECT1" | |
103 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
104 NAME="AEN6125" |
0 | 105 ></A |
106 ><H2 | |
107 >Structure Data</H2 | |
108 ><DIV | |
109 CLASS="INFORMALTABLE" | |
110 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
111 NAME="AEN6127" |
0 | 112 ></A |
113 ><P | |
114 ></P | |
115 ><TABLE | |
116 BORDER="0" | |
117 CLASS="CALSTABLE" | |
118 ><TBODY | |
119 ><TR | |
120 ><TD | |
121 ALIGN="LEFT" | |
122 VALIGN="TOP" | |
123 ><TT | |
124 CLASS="STRUCTFIELD" | |
125 ><I | |
126 >freq</I | |
127 ></TT | |
128 ></TD | |
129 ><TD | |
130 ALIGN="LEFT" | |
131 VALIGN="TOP" | |
132 >Audio frequency in samples per second</TD | |
133 ></TR | |
134 ><TR | |
135 ><TD | |
136 ALIGN="LEFT" | |
137 VALIGN="TOP" | |
138 ><TT | |
139 CLASS="STRUCTFIELD" | |
140 ><I | |
141 >format</I | |
142 ></TT | |
143 ></TD | |
144 ><TD | |
145 ALIGN="LEFT" | |
146 VALIGN="TOP" | |
147 >Audio data format</TD | |
148 ></TR | |
149 ><TR | |
150 ><TD | |
151 ALIGN="LEFT" | |
152 VALIGN="TOP" | |
153 ><TT | |
154 CLASS="STRUCTFIELD" | |
155 ><I | |
156 >channels</I | |
157 ></TT | |
158 ></TD | |
159 ><TD | |
160 ALIGN="LEFT" | |
161 VALIGN="TOP" | |
162 >Number of channels: 1 mono, 2 stereo</TD | |
163 ></TR | |
164 ><TR | |
165 ><TD | |
166 ALIGN="LEFT" | |
167 VALIGN="TOP" | |
168 ><TT | |
169 CLASS="STRUCTFIELD" | |
170 ><I | |
171 >silence</I | |
172 ></TT | |
173 ></TD | |
174 ><TD | |
175 ALIGN="LEFT" | |
176 VALIGN="TOP" | |
177 >Audio buffer silence value (calculated)</TD | |
178 ></TR | |
179 ><TR | |
180 ><TD | |
181 ALIGN="LEFT" | |
182 VALIGN="TOP" | |
183 ><TT | |
184 CLASS="STRUCTFIELD" | |
185 ><I | |
186 >samples</I | |
187 ></TT | |
188 ></TD | |
189 ><TD | |
190 ALIGN="LEFT" | |
191 VALIGN="TOP" | |
192 >Audio buffer size in samples</TD | |
193 ></TR | |
194 ><TR | |
195 ><TD | |
196 ALIGN="LEFT" | |
197 VALIGN="TOP" | |
198 ><TT | |
199 CLASS="STRUCTFIELD" | |
200 ><I | |
201 >size</I | |
202 ></TT | |
203 ></TD | |
204 ><TD | |
205 ALIGN="LEFT" | |
206 VALIGN="TOP" | |
207 >Audio buffer size in bytes (calculated)</TD | |
208 ></TR | |
209 ><TR | |
210 ><TD | |
211 ALIGN="LEFT" | |
212 VALIGN="TOP" | |
213 ><TT | |
214 CLASS="STRUCTFIELD" | |
215 ><I | |
216 >callback(..)</I | |
217 ></TT | |
218 ></TD | |
219 ><TD | |
220 ALIGN="LEFT" | |
221 VALIGN="TOP" | |
222 >Callback function for filling the audio buffer</TD | |
223 ></TR | |
224 ><TR | |
225 ><TD | |
226 ALIGN="LEFT" | |
227 VALIGN="TOP" | |
228 ><TT | |
229 CLASS="STRUCTFIELD" | |
230 ><I | |
231 >userdata</I | |
232 ></TT | |
233 ></TD | |
234 ><TD | |
235 ALIGN="LEFT" | |
236 VALIGN="TOP" | |
237 >Pointer the user data which is passed to the callback function</TD | |
238 ></TR | |
239 ></TBODY | |
240 ></TABLE | |
241 ><P | |
242 ></P | |
243 ></DIV | |
244 ></DIV | |
245 ><DIV | |
246 CLASS="REFSECT1" | |
247 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
248 NAME="AEN6162" |
0 | 249 ></A |
250 ><H2 | |
251 >Description</H2 | |
252 ><P | |
253 >The <SPAN | |
254 CLASS="STRUCTNAME" | |
255 >SDL_AudioSpec</SPAN | |
256 > structure is used to describe the format of some audio data. This structure is used by <A | |
257 HREF="sdlopenaudio.html" | |
258 ><TT | |
259 CLASS="FUNCTION" | |
260 >SDL_OpenAudio</TT | |
261 ></A | |
262 > and <A | |
263 HREF="sdlloadwav.html" | |
264 ><TT | |
265 CLASS="FUNCTION" | |
266 >SDL_LoadWAV</TT | |
267 ></A | |
268 >. While all fields are used by <TT | |
269 CLASS="FUNCTION" | |
270 >SDL_OpenAudio</TT | |
271 > only <TT | |
272 CLASS="STRUCTFIELD" | |
273 ><I | |
274 >freq</I | |
275 ></TT | |
276 >, <TT | |
277 CLASS="STRUCTFIELD" | |
278 ><I | |
279 >format</I | |
280 ></TT | |
281 >, <TT | |
282 CLASS="STRUCTFIELD" | |
283 ><I | |
284 >samples</I | |
285 ></TT | |
286 > and <TT | |
287 CLASS="STRUCTFIELD" | |
288 ><I | |
289 >channels</I | |
290 ></TT | |
291 > are used by <TT | |
292 CLASS="FUNCTION" | |
293 >SDL_LoadWAV</TT | |
294 >. We will detail these common members here.</P | |
295 ><DIV | |
296 CLASS="INFORMALTABLE" | |
297 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
298 NAME="AEN6176" |
0 | 299 ></A |
300 ><P | |
301 ></P | |
302 ><TABLE | |
303 BORDER="0" | |
304 CLASS="CALSTABLE" | |
305 ><TBODY | |
306 ><TR | |
307 ><TD | |
308 ALIGN="LEFT" | |
309 VALIGN="TOP" | |
310 ><TT | |
311 CLASS="STRUCTFIELD" | |
312 ><I | |
313 >freq</I | |
314 ></TT | |
315 ></TD | |
316 ><TD | |
317 ALIGN="LEFT" | |
318 VALIGN="TOP" | |
319 ><P | |
320 >The number of samples sent to the sound device every second. Common values are 11025, 22050 and 44100. The higher the better.</P | |
321 ></TD | |
322 ></TR | |
323 ><TR | |
324 ><TD | |
325 ALIGN="LEFT" | |
326 VALIGN="TOP" | |
327 ><TT | |
328 CLASS="STRUCTFIELD" | |
329 ><I | |
330 >format</I | |
331 ></TT | |
332 ></TD | |
333 ><TD | |
334 ALIGN="LEFT" | |
335 VALIGN="TOP" | |
336 ><P | |
337 >Specifies the size and type of each sample element | |
338 <P | |
339 ></P | |
340 ><DIV | |
341 CLASS="VARIABLELIST" | |
342 ><DL | |
343 ><DT | |
344 ><TT | |
345 CLASS="LITERAL" | |
346 >AUDIO_U8</TT | |
347 ></DT | |
348 ><DD | |
349 ><P | |
350 >Unsigned 8-bit samples</P | |
351 ></DD | |
352 ><DT | |
353 ><TT | |
354 CLASS="LITERAL" | |
355 >AUDIO_S8</TT | |
356 ></DT | |
357 ><DD | |
358 ><P | |
359 >Signed 8-bit samples</P | |
360 ></DD | |
361 ><DT | |
362 ><TT | |
363 CLASS="LITERAL" | |
364 >AUDIO_U16</TT | |
365 > or <TT | |
366 CLASS="LITERAL" | |
367 >AUDIO_U16LSB</TT | |
368 ></DT | |
369 ><DD | |
370 ><P | |
371 >Unsigned 16-bit little-endian samples</P | |
372 ></DD | |
373 ><DT | |
374 ><TT | |
375 CLASS="LITERAL" | |
376 >AUDIO_S16</TT | |
377 > or <TT | |
378 CLASS="LITERAL" | |
379 >AUDIO_S16LSB</TT | |
380 ></DT | |
381 ><DD | |
382 ><P | |
383 >Signed 16-bit little-endian samples</P | |
384 ></DD | |
385 ><DT | |
386 ><TT | |
387 CLASS="LITERAL" | |
388 >AUDIO_U16MSB</TT | |
389 ></DT | |
390 ><DD | |
391 ><P | |
392 >Unsigned 16-bit big-endian samples</P | |
393 ></DD | |
394 ><DT | |
395 ><TT | |
396 CLASS="LITERAL" | |
397 >AUDIO_S16MSB</TT | |
398 ></DT | |
399 ><DD | |
400 ><P | |
401 >Signed 16-bit big-endian samples</P | |
402 ></DD | |
403 ><DT | |
404 ><TT | |
405 CLASS="LITERAL" | |
406 >AUDIO_U16SYS</TT | |
407 ></DT | |
408 ><DD | |
409 ><P | |
410 >Either <TT | |
411 CLASS="LITERAL" | |
412 >AUDIO_U16LSB</TT | |
413 > or <TT | |
414 CLASS="LITERAL" | |
415 >AUDIO_U16MSB</TT | |
416 > depending on you systems endianness</P | |
417 ></DD | |
418 ><DT | |
419 ><TT | |
420 CLASS="LITERAL" | |
421 >AUDIO_S16SYS</TT | |
422 ></DT | |
423 ><DD | |
424 ><P | |
425 >Either <TT | |
426 CLASS="LITERAL" | |
427 >AUDIO_S16LSB</TT | |
428 > or <TT | |
429 CLASS="LITERAL" | |
430 >AUDIO_S16MSB</TT | |
431 > depending on you systems endianness</P | |
432 ></DD | |
433 ></DL | |
434 ></DIV | |
435 ></P | |
436 ></TD | |
437 ></TR | |
438 ><TR | |
439 ><TD | |
440 ALIGN="LEFT" | |
441 VALIGN="TOP" | |
442 ><TT | |
443 CLASS="STRUCTFIELD" | |
444 ><I | |
445 >channels</I | |
446 ></TT | |
447 ></TD | |
448 ><TD | |
449 ALIGN="LEFT" | |
450 VALIGN="TOP" | |
451 >The number of seperate sound channels. 1 is mono (single channel), 2 is stereo (dual channel).</TD | |
452 ></TR | |
453 ><TR | |
454 ><TD | |
455 ALIGN="LEFT" | |
456 VALIGN="TOP" | |
457 ><TT | |
458 CLASS="STRUCTFIELD" | |
459 ><I | |
460 >samples</I | |
461 ></TT | |
462 ></TD | |
463 ><TD | |
464 ALIGN="LEFT" | |
465 VALIGN="TOP" | |
466 >When used with <A | |
467 HREF="sdlopenaudio.html" | |
468 ><TT | |
469 CLASS="FUNCTION" | |
470 >SDL_OpenAudio</TT | |
471 ></A | |
472 > this refers to the size of the audio buffer in samples. A sample a chunk of audio data of the size specified in <TT | |
473 CLASS="PARAMETER" | |
474 ><I | |
475 >format</I | |
476 ></TT | |
477 > mulitplied by the number of channels. When the <SPAN | |
478 CLASS="STRUCTNAME" | |
479 >SDL_AudioSpec</SPAN | |
480 > is used with <A | |
481 HREF="sdlloadwav.html" | |
482 ><TT | |
483 CLASS="FUNCTION" | |
484 >SDL_LoadWAV</TT | |
485 ></A | |
486 > <TT | |
487 CLASS="STRUCTFIELD" | |
488 ><I | |
489 >samples</I | |
490 ></TT | |
491 > is set to 4096.</TD | |
492 ></TR | |
493 ></TBODY | |
494 ></TABLE | |
495 ><P | |
496 ></P | |
497 ></DIV | |
498 ></DIV | |
499 ><DIV | |
500 CLASS="REFSECT1" | |
501 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
502 NAME="AEN6251" |
0 | 503 ></A |
504 ><H2 | |
505 >See Also</H2 | |
506 ><P | |
507 ><A | |
508 HREF="sdlopenaudio.html" | |
509 ><TT | |
510 CLASS="FUNCTION" | |
511 >SDL_OpenAudio</TT | |
512 ></A | |
513 >, | |
514 <A | |
515 HREF="sdlloadwav.html" | |
516 ><TT | |
517 CLASS="FUNCTION" | |
518 >SDL_LoadWAV</TT | |
519 ></A | |
520 ></P | |
521 ></DIV | |
522 ><DIV | |
523 CLASS="NAVFOOTER" | |
524 ><HR | |
525 ALIGN="LEFT" | |
526 WIDTH="100%"><TABLE | |
527 WIDTH="100%" | |
528 BORDER="0" | |
529 CELLPADDING="0" | |
530 CELLSPACING="0" | |
531 ><TR | |
532 ><TD | |
533 WIDTH="33%" | |
534 ALIGN="left" | |
535 VALIGN="top" | |
536 ><A | |
537 HREF="audio.html" | |
538 >Prev</A | |
539 ></TD | |
540 ><TD | |
541 WIDTH="34%" | |
542 ALIGN="center" | |
543 VALIGN="top" | |
544 ><A | |
545 HREF="index.html" | |
546 >Home</A | |
547 ></TD | |
548 ><TD | |
549 WIDTH="33%" | |
550 ALIGN="right" | |
551 VALIGN="top" | |
552 ><A | |
553 HREF="sdlopenaudio.html" | |
554 >Next</A | |
555 ></TD | |
556 ></TR | |
557 ><TR | |
558 ><TD | |
559 WIDTH="33%" | |
560 ALIGN="left" | |
561 VALIGN="top" | |
562 >Audio</TD | |
563 ><TD | |
564 WIDTH="34%" | |
565 ALIGN="center" | |
566 VALIGN="top" | |
567 ><A | |
568 HREF="audio.html" | |
569 >Up</A | |
570 ></TD | |
571 ><TD | |
572 WIDTH="33%" | |
573 ALIGN="right" | |
574 VALIGN="top" | |
575 >SDL_OpenAudio</TD | |
576 ></TR | |
577 ></TABLE | |
578 ></DIV | |
579 ></BODY | |
580 ></HTML | |
581 > |