docs/man3/SDL_AudioCVT.3
author Sam Lantinga <slouken@libsdl.org>
Wed, 08 Mar 2006 18:30:12 +0000
changeset 1486 9d77fc9d0ace
parent 181 e5bc29de3f0a
child 2283 546f7c1eb755
permissions -rw-r--r--
Re-added C runtime support for Visual C++ 5,6
slouken@181
     1
.TH "SDL_AudioCVT" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" 
slouken@0
     2
.SH "NAME"
slouken@0
     3
SDL_AudioCVT\- Audio Conversion Structure
slouken@0
     4
.SH "STRUCTURE DEFINITION"
slouken@0
     5
.PP
slouken@0
     6
.nf
slouken@0
     7
\f(CWtypedef struct{
slouken@0
     8
  int needed;
slouken@0
     9
  Uint16 src_format;
slouken@0
    10
  Uint16 dest_format;
slouken@0
    11
  double rate_incr;
slouken@0
    12
  Uint8 *buf;
slouken@0
    13
  int len;
slouken@0
    14
  int len_cvt;
slouken@0
    15
  int len_mult;
slouken@0
    16
  double len_ratio;
slouken@0
    17
  void (*filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
slouken@0
    18
  int filter_index;
slouken@0
    19
} SDL_AudioCVT;\fR
slouken@0
    20
.fi
slouken@0
    21
.PP
slouken@0
    22
.SH "STRUCTURE DATA"
slouken@0
    23
.TP 20
slouken@0
    24
\fBneeded\fR
slouken@0
    25
Set to one if the conversion is possible
slouken@0
    26
.TP 20
slouken@0
    27
\fBsrc_format\fR
slouken@0
    28
Audio format of the source
slouken@0
    29
.TP 20
slouken@0
    30
\fBdest_format\fR
slouken@0
    31
Audio format of the destination
slouken@0
    32
.TP 20
slouken@0
    33
\fBrate_incr\fR
slouken@0
    34
Rate conversion increment
slouken@0
    35
.TP 20
slouken@0
    36
\fBbuf\fR
slouken@0
    37
Audio buffer
slouken@0
    38
.TP 20
slouken@0
    39
\fBlen\fR
slouken@0
    40
Length of the original audio buffer in bytes
slouken@0
    41
.TP 20
slouken@0
    42
\fBlen_cvt\fR
slouken@0
    43
Length of converted audio buffer in bytes (calculated)
slouken@0
    44
.TP 20
slouken@0
    45
\fBlen_mult\fR
slouken@0
    46
\fBbuf\fR must be \fBlen\fR*\fBlen_mult\fR bytes in size(calculated)
slouken@0
    47
.TP 20
slouken@0
    48
\fBlen_ratio\fR
slouken@0
    49
Final audio size is \fBlen\fR*\fBlen_ratio\fR
slouken@0
    50
.TP 20
slouken@0
    51
\fBfilters[10](\&.\&.)\fR
slouken@0
    52
Pointers to functions needed for this conversion
slouken@0
    53
.TP 20
slouken@0
    54
\fBfilter_index\fR
slouken@0
    55
Current conversion function
slouken@0
    56
.SH "DESCRIPTION"
slouken@0
    57
.PP
slouken@0
    58
The \fBSDL_AudioCVT\fR is used to convert audio data between different formats\&. A \fBSDL_AudioCVT\fR structure is created with the \fI\fBSDL_BuildAudioCVT\fP\fR function, while the actual conversion is done by the \fI\fBSDL_ConvertAudio\fP\fR function\&.
slouken@0
    59
.PP
slouken@0
    60
Many of the fields in the \fBSDL_AudioCVT\fR structure should be considered private and their function will not be discussed here\&.
slouken@0
    61
.IP "\fBUint8 *\fP\fBbuf\fR" 10This 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 \fBbuf\fR is large enough\&. See below\&.
slouken@0
    62
.IP "\fBint\fP \fBlen\fR" 10This is the length of the original audio data in bytes\&.
slouken@0
    63
.IP "\fBint\fP \fBlen_mult\fR" 10As 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 \fBbuf\fR should be \fBlen\fR*\fBlen_mult\fR\&.
slouken@0
    64
.IP "\fBdouble\fP \fBlen_ratio\fR" 10When you have finished converting your audio data, you need to know how much of your audio buffer is valid\&. \fBlen\fR*\fBlen_ratio\fR is the size of the converted audio data in bytes\&. This is very similar to \fBlen_mult\fR, however when the convert audio data is shorter than the original \fBlen_mult\fR would be 1\&. \fBlen_ratio\fR, on the other hand, would be a fractional number between 0 and 1\&.
slouken@0
    65
.SH "SEE ALSO"
slouken@0
    66
.PP
slouken@0
    67
\fI\fBSDL_BuildAudioCVT\fP\fR, \fI\fBSDL_ConvertAudio\fP\fR, \fI\fBSDL_AudioSpec\fR\fR
slouken@181
    68
...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58