docs/html/sdlaudiocvt.html
changeset 3352 6dc250ebdd80
parent 3351 8e0182c236d8
child 3353 6b14223dd5c7
     1.1 --- a/docs/html/sdlaudiocvt.html	Wed Oct 07 06:11:53 2009 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,556 +0,0 @@
     1.4 -<HTML
     1.5 -><HEAD
     1.6 -><TITLE
     1.7 ->SDL_AudioCVT</TITLE
     1.8 -><META
     1.9 -NAME="GENERATOR"
    1.10 -CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
    1.11 -"><LINK
    1.12 -REL="HOME"
    1.13 -TITLE="SDL Library Documentation"
    1.14 -HREF="index.html"><LINK
    1.15 -REL="UP"
    1.16 -TITLE="Audio"
    1.17 -HREF="audio.html"><LINK
    1.18 -REL="PREVIOUS"
    1.19 -TITLE="SDL_FreeWAV"
    1.20 -HREF="sdlfreewav.html"><LINK
    1.21 -REL="NEXT"
    1.22 -TITLE="SDL_BuildAudioCVT"
    1.23 -HREF="sdlbuildaudiocvt.html"></HEAD
    1.24 -><BODY
    1.25 -CLASS="REFENTRY"
    1.26 -BGCOLOR="#FFF8DC"
    1.27 -TEXT="#000000"
    1.28 -LINK="#0000ee"
    1.29 -VLINK="#551a8b"
    1.30 -ALINK="#ff0000"
    1.31 -><DIV
    1.32 -CLASS="NAVHEADER"
    1.33 -><TABLE
    1.34 -SUMMARY="Header navigation table"
    1.35 -WIDTH="100%"
    1.36 -BORDER="0"
    1.37 -CELLPADDING="0"
    1.38 -CELLSPACING="0"
    1.39 -><TR
    1.40 -><TH
    1.41 -COLSPAN="3"
    1.42 -ALIGN="center"
    1.43 ->SDL Library Documentation</TH
    1.44 -></TR
    1.45 -><TR
    1.46 -><TD
    1.47 -WIDTH="10%"
    1.48 -ALIGN="left"
    1.49 -VALIGN="bottom"
    1.50 -><A
    1.51 -HREF="sdlfreewav.html"
    1.52 -ACCESSKEY="P"
    1.53 ->Prev</A
    1.54 -></TD
    1.55 -><TD
    1.56 -WIDTH="80%"
    1.57 -ALIGN="center"
    1.58 -VALIGN="bottom"
    1.59 -></TD
    1.60 -><TD
    1.61 -WIDTH="10%"
    1.62 -ALIGN="right"
    1.63 -VALIGN="bottom"
    1.64 -><A
    1.65 -HREF="sdlbuildaudiocvt.html"
    1.66 -ACCESSKEY="N"
    1.67 ->Next</A
    1.68 -></TD
    1.69 -></TR
    1.70 -></TABLE
    1.71 -><HR
    1.72 -ALIGN="LEFT"
    1.73 -WIDTH="100%"></DIV
    1.74 -><H1
    1.75 -><A
    1.76 -NAME="SDLAUDIOCVT"
    1.77 -></A
    1.78 ->SDL_AudioCVT</H1
    1.79 -><DIV
    1.80 -CLASS="REFNAMEDIV"
    1.81 -><A
    1.82 -NAME="AEN6884"
    1.83 -></A
    1.84 -><H2
    1.85 ->Name</H2
    1.86 ->SDL_AudioCVT&nbsp;--&nbsp;Audio Conversion Structure</DIV
    1.87 -><DIV
    1.88 -CLASS="REFSECT1"
    1.89 -><A
    1.90 -NAME="AEN6887"
    1.91 -></A
    1.92 -><H2
    1.93 ->Structure Definition</H2
    1.94 -><PRE
    1.95 -CLASS="PROGRAMLISTING"
    1.96 ->typedef struct{
    1.97 -  int needed;
    1.98 -  Uint16 src_format;
    1.99 -  Uint16 dest_format;
   1.100 -  double rate_incr;
   1.101 -  Uint8 *buf;
   1.102 -  int len;
   1.103 -  int len_cvt;
   1.104 -  int len_mult;
   1.105 -  double len_ratio;
   1.106 -  void (*filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
   1.107 -  int filter_index;
   1.108 -} SDL_AudioCVT;</PRE
   1.109 -></DIV
   1.110 -><DIV
   1.111 -CLASS="REFSECT1"
   1.112 -><A
   1.113 -NAME="AEN6890"
   1.114 -></A
   1.115 -><H2
   1.116 ->Structure Data</H2
   1.117 -><DIV
   1.118 -CLASS="INFORMALTABLE"
   1.119 -><A
   1.120 -NAME="AEN6892"
   1.121 -></A
   1.122 -><P
   1.123 -></P
   1.124 -><TABLE
   1.125 -BORDER="0"
   1.126 -CLASS="CALSTABLE"
   1.127 -><TBODY
   1.128 -><TR
   1.129 -><TD
   1.130 -ALIGN="LEFT"
   1.131 -VALIGN="TOP"
   1.132 -><TT
   1.133 -CLASS="STRUCTFIELD"
   1.134 -><I
   1.135 ->needed</I
   1.136 -></TT
   1.137 -></TD
   1.138 -><TD
   1.139 -ALIGN="LEFT"
   1.140 -VALIGN="TOP"
   1.141 ->Set to one if the conversion is possible</TD
   1.142 -></TR
   1.143 -><TR
   1.144 -><TD
   1.145 -ALIGN="LEFT"
   1.146 -VALIGN="TOP"
   1.147 -><TT
   1.148 -CLASS="STRUCTFIELD"
   1.149 -><I
   1.150 ->src_format</I
   1.151 -></TT
   1.152 -></TD
   1.153 -><TD
   1.154 -ALIGN="LEFT"
   1.155 -VALIGN="TOP"
   1.156 ->Audio format of the source</TD
   1.157 -></TR
   1.158 -><TR
   1.159 -><TD
   1.160 -ALIGN="LEFT"
   1.161 -VALIGN="TOP"
   1.162 -><TT
   1.163 -CLASS="STRUCTFIELD"
   1.164 -><I
   1.165 ->dest_format</I
   1.166 -></TT
   1.167 -></TD
   1.168 -><TD
   1.169 -ALIGN="LEFT"
   1.170 -VALIGN="TOP"
   1.171 ->Audio format of the destination</TD
   1.172 -></TR
   1.173 -><TR
   1.174 -><TD
   1.175 -ALIGN="LEFT"
   1.176 -VALIGN="TOP"
   1.177 -><TT
   1.178 -CLASS="STRUCTFIELD"
   1.179 -><I
   1.180 ->rate_incr</I
   1.181 -></TT
   1.182 -></TD
   1.183 -><TD
   1.184 -ALIGN="LEFT"
   1.185 -VALIGN="TOP"
   1.186 ->Rate conversion increment</TD
   1.187 -></TR
   1.188 -><TR
   1.189 -><TD
   1.190 -ALIGN="LEFT"
   1.191 -VALIGN="TOP"
   1.192 -><TT
   1.193 -CLASS="STRUCTFIELD"
   1.194 -><I
   1.195 ->buf</I
   1.196 -></TT
   1.197 -></TD
   1.198 -><TD
   1.199 -ALIGN="LEFT"
   1.200 -VALIGN="TOP"
   1.201 ->Audio buffer</TD
   1.202 -></TR
   1.203 -><TR
   1.204 -><TD
   1.205 -ALIGN="LEFT"
   1.206 -VALIGN="TOP"
   1.207 -><TT
   1.208 -CLASS="STRUCTFIELD"
   1.209 -><I
   1.210 ->len</I
   1.211 -></TT
   1.212 -></TD
   1.213 -><TD
   1.214 -ALIGN="LEFT"
   1.215 -VALIGN="TOP"
   1.216 ->Length of the original audio buffer in bytes</TD
   1.217 -></TR
   1.218 -><TR
   1.219 -><TD
   1.220 -ALIGN="LEFT"
   1.221 -VALIGN="TOP"
   1.222 -><TT
   1.223 -CLASS="STRUCTFIELD"
   1.224 -><I
   1.225 ->len_cvt</I
   1.226 -></TT
   1.227 -></TD
   1.228 -><TD
   1.229 -ALIGN="LEFT"
   1.230 -VALIGN="TOP"
   1.231 ->Length of converted audio buffer in bytes (calculated)</TD
   1.232 -></TR
   1.233 -><TR
   1.234 -><TD
   1.235 -ALIGN="LEFT"
   1.236 -VALIGN="TOP"
   1.237 -><TT
   1.238 -CLASS="STRUCTFIELD"
   1.239 -><I
   1.240 ->len_mult</I
   1.241 -></TT
   1.242 -></TD
   1.243 -><TD
   1.244 -ALIGN="LEFT"
   1.245 -VALIGN="TOP"
   1.246 -><TT
   1.247 -CLASS="STRUCTFIELD"
   1.248 -><I
   1.249 ->buf</I
   1.250 -></TT
   1.251 -> must be <TT
   1.252 -CLASS="STRUCTFIELD"
   1.253 -><I
   1.254 ->len</I
   1.255 -></TT
   1.256 ->*<TT
   1.257 -CLASS="STRUCTFIELD"
   1.258 -><I
   1.259 ->len_mult</I
   1.260 -></TT
   1.261 -> bytes in size(calculated)</TD
   1.262 -></TR
   1.263 -><TR
   1.264 -><TD
   1.265 -ALIGN="LEFT"
   1.266 -VALIGN="TOP"
   1.267 -><TT
   1.268 -CLASS="STRUCTFIELD"
   1.269 -><I
   1.270 ->len_ratio</I
   1.271 -></TT
   1.272 -></TD
   1.273 -><TD
   1.274 -ALIGN="LEFT"
   1.275 -VALIGN="TOP"
   1.276 ->Final audio size is <TT
   1.277 -CLASS="STRUCTFIELD"
   1.278 -><I
   1.279 ->len</I
   1.280 -></TT
   1.281 ->*<TT
   1.282 -CLASS="STRUCTFIELD"
   1.283 -><I
   1.284 ->len_ratio</I
   1.285 -></TT
   1.286 -></TD
   1.287 -></TR
   1.288 -><TR
   1.289 -><TD
   1.290 -ALIGN="LEFT"
   1.291 -VALIGN="TOP"
   1.292 -><TT
   1.293 -CLASS="STRUCTFIELD"
   1.294 -><I
   1.295 ->filters[10](..)</I
   1.296 -></TT
   1.297 -></TD
   1.298 -><TD
   1.299 -ALIGN="LEFT"
   1.300 -VALIGN="TOP"
   1.301 ->Pointers to functions needed for this conversion</TD
   1.302 -></TR
   1.303 -><TR
   1.304 -><TD
   1.305 -ALIGN="LEFT"
   1.306 -VALIGN="TOP"
   1.307 -><TT
   1.308 -CLASS="STRUCTFIELD"
   1.309 -><I
   1.310 ->filter_index</I
   1.311 -></TT
   1.312 -></TD
   1.313 -><TD
   1.314 -ALIGN="LEFT"
   1.315 -VALIGN="TOP"
   1.316 ->Current conversion function</TD
   1.317 -></TR
   1.318 -></TBODY
   1.319 -></TABLE
   1.320 -><P
   1.321 -></P
   1.322 -></DIV
   1.323 -></DIV
   1.324 -><DIV
   1.325 -CLASS="REFSECT1"
   1.326 -><A
   1.327 -NAME="AEN6944"
   1.328 -></A
   1.329 -><H2
   1.330 ->Description</H2
   1.331 -><P
   1.332 ->The <SPAN
   1.333 -CLASS="STRUCTNAME"
   1.334 ->SDL_AudioCVT</SPAN
   1.335 -> is used to convert audio data between different formats. A <SPAN
   1.336 -CLASS="STRUCTNAME"
   1.337 ->SDL_AudioCVT</SPAN
   1.338 -> structure is created with the <A
   1.339 -HREF="sdlbuildaudiocvt.html"
   1.340 -><TT
   1.341 -CLASS="FUNCTION"
   1.342 ->SDL_BuildAudioCVT</TT
   1.343 -></A
   1.344 -> function, while the actual conversion is done by the <A
   1.345 -HREF="sdlconvertaudio.html"
   1.346 -><TT
   1.347 -CLASS="FUNCTION"
   1.348 ->SDL_ConvertAudio</TT
   1.349 -></A
   1.350 -> function.</P
   1.351 -><P
   1.352 ->Many of the fields in the <SPAN
   1.353 -CLASS="STRUCTNAME"
   1.354 ->SDL_AudioCVT</SPAN
   1.355 -> structure should be considered private and their function will not be discussed here.</P
   1.356 -><P
   1.357 -></P
   1.358 -><DIV
   1.359 -CLASS="VARIABLELIST"
   1.360 -><DL
   1.361 -><DT
   1.362 -><SPAN
   1.363 -CLASS="TYPE"
   1.364 ->Uint8 *</SPAN
   1.365 -><TT
   1.366 -CLASS="STRUCTFIELD"
   1.367 -><I
   1.368 ->buf</I
   1.369 -></TT
   1.370 -></DT
   1.371 -><DD
   1.372 -><P
   1.373 ->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
   1.374 -CLASS="STRUCTFIELD"
   1.375 -><I
   1.376 ->buf</I
   1.377 -></TT
   1.378 -> is large enough. See below.</P
   1.379 -></DD
   1.380 -><DT
   1.381 -><SPAN
   1.382 -CLASS="TYPE"
   1.383 ->int</SPAN
   1.384 -> <TT
   1.385 -CLASS="STRUCTFIELD"
   1.386 -><I
   1.387 ->len</I
   1.388 -></TT
   1.389 -></DT
   1.390 -><DD
   1.391 -><P
   1.392 ->This is the length of the original audio data in bytes.</P
   1.393 -></DD
   1.394 -><DT
   1.395 -><SPAN
   1.396 -CLASS="TYPE"
   1.397 ->int</SPAN
   1.398 -> <TT
   1.399 -CLASS="STRUCTFIELD"
   1.400 -><I
   1.401 ->len_mult</I
   1.402 -></TT
   1.403 -></DT
   1.404 -><DD
   1.405 -><P
   1.406 ->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
   1.407 -CLASS="STRUCTFIELD"
   1.408 -><I
   1.409 ->buf</I
   1.410 -></TT
   1.411 -> should be <TT
   1.412 -CLASS="STRUCTFIELD"
   1.413 -><I
   1.414 ->len</I
   1.415 -></TT
   1.416 ->*<TT
   1.417 -CLASS="STRUCTFIELD"
   1.418 -><I
   1.419 ->len_mult</I
   1.420 -></TT
   1.421 ->.</P
   1.422 -></DD
   1.423 -><DT
   1.424 -><SPAN
   1.425 -CLASS="TYPE"
   1.426 ->double</SPAN
   1.427 -> <TT
   1.428 -CLASS="STRUCTFIELD"
   1.429 -><I
   1.430 ->len_ratio</I
   1.431 -></TT
   1.432 -></DT
   1.433 -><DD
   1.434 -><P
   1.435 ->When you have finished converting your audio data, you need to know how much of your audio buffer is valid. <TT
   1.436 -CLASS="STRUCTFIELD"
   1.437 -><I
   1.438 ->len</I
   1.439 -></TT
   1.440 ->*<TT
   1.441 -CLASS="STRUCTFIELD"
   1.442 -><I
   1.443 ->len_ratio</I
   1.444 -></TT
   1.445 -> is the size of the converted audio data in bytes. This is very similar to <TT
   1.446 -CLASS="STRUCTFIELD"
   1.447 -><I
   1.448 ->len_mult</I
   1.449 -></TT
   1.450 ->, however when the convert audio data is shorter than the original <TT
   1.451 -CLASS="STRUCTFIELD"
   1.452 -><I
   1.453 ->len_mult</I
   1.454 -></TT
   1.455 -> would be 1. <TT
   1.456 -CLASS="STRUCTFIELD"
   1.457 -><I
   1.458 ->len_ratio</I
   1.459 -></TT
   1.460 ->, on the other hand, would be a fractional number between 0 and 1.</P
   1.461 -></DD
   1.462 -></DL
   1.463 -></DIV
   1.464 -></DIV
   1.465 -><DIV
   1.466 -CLASS="REFSECT1"
   1.467 -><A
   1.468 -NAME="AEN6989"
   1.469 -></A
   1.470 -><H2
   1.471 ->See Also</H2
   1.472 -><P
   1.473 -><A
   1.474 -HREF="sdlbuildaudiocvt.html"
   1.475 -><TT
   1.476 -CLASS="FUNCTION"
   1.477 ->SDL_BuildAudioCVT</TT
   1.478 -></A
   1.479 ->,
   1.480 -<A
   1.481 -HREF="sdlconvertaudio.html"
   1.482 -><TT
   1.483 -CLASS="FUNCTION"
   1.484 ->SDL_ConvertAudio</TT
   1.485 -></A
   1.486 ->,
   1.487 -<A
   1.488 -HREF="sdlaudiospec.html"
   1.489 -><SPAN
   1.490 -CLASS="STRUCTNAME"
   1.491 ->SDL_AudioSpec</SPAN
   1.492 -></A
   1.493 -></P
   1.494 -></DIV
   1.495 -><DIV
   1.496 -CLASS="NAVFOOTER"
   1.497 -><HR
   1.498 -ALIGN="LEFT"
   1.499 -WIDTH="100%"><TABLE
   1.500 -SUMMARY="Footer navigation table"
   1.501 -WIDTH="100%"
   1.502 -BORDER="0"
   1.503 -CELLPADDING="0"
   1.504 -CELLSPACING="0"
   1.505 -><TR
   1.506 -><TD
   1.507 -WIDTH="33%"
   1.508 -ALIGN="left"
   1.509 -VALIGN="top"
   1.510 -><A
   1.511 -HREF="sdlfreewav.html"
   1.512 -ACCESSKEY="P"
   1.513 ->Prev</A
   1.514 -></TD
   1.515 -><TD
   1.516 -WIDTH="34%"
   1.517 -ALIGN="center"
   1.518 -VALIGN="top"
   1.519 -><A
   1.520 -HREF="index.html"
   1.521 -ACCESSKEY="H"
   1.522 ->Home</A
   1.523 -></TD
   1.524 -><TD
   1.525 -WIDTH="33%"
   1.526 -ALIGN="right"
   1.527 -VALIGN="top"
   1.528 -><A
   1.529 -HREF="sdlbuildaudiocvt.html"
   1.530 -ACCESSKEY="N"
   1.531 ->Next</A
   1.532 -></TD
   1.533 -></TR
   1.534 -><TR
   1.535 -><TD
   1.536 -WIDTH="33%"
   1.537 -ALIGN="left"
   1.538 -VALIGN="top"
   1.539 ->SDL_FreeWAV</TD
   1.540 -><TD
   1.541 -WIDTH="34%"
   1.542 -ALIGN="center"
   1.543 -VALIGN="top"
   1.544 -><A
   1.545 -HREF="audio.html"
   1.546 -ACCESSKEY="U"
   1.547 ->Up</A
   1.548 -></TD
   1.549 -><TD
   1.550 -WIDTH="33%"
   1.551 -ALIGN="right"
   1.552 -VALIGN="top"
   1.553 ->SDL_BuildAudioCVT</TD
   1.554 -></TR
   1.555 -></TABLE
   1.556 -></DIV
   1.557 -></BODY
   1.558 -></HTML
   1.559 ->
   1.560 \ No newline at end of file