docs/man3/SDL_AudioSpec.3
author Aaron Wishnick <schnarf@gmail.com>
Wed, 18 Jun 2008 04:51:10 +0000
branchgsoc2008_audio_resampling
changeset 2655 b8e736c8a5a8
parent 2283 546f7c1eb755
child 4311 1238da4a7112
permissions -rw-r--r--
Added beginnings of resampling code.
slouken@181
     1
.TH "SDL_AudioSpec" "3" "Tue 11 Sep 2001, 22:58" "SDL" "SDL API Reference" 
slouken@0
     2
.SH "NAME"
slouken@2283
     3
SDL_AudioSpec \- Audio Specification 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 freq;
slouken@0
     9
  Uint16 format;
slouken@0
    10
  Uint8 channels;
slouken@0
    11
  Uint8 silence;
slouken@0
    12
  Uint16 samples;
slouken@0
    13
  Uint32 size;
slouken@0
    14
  void (*callback)(void *userdata, Uint8 *stream, int len);
slouken@0
    15
  void *userdata;
slouken@0
    16
} SDL_AudioSpec;\fR
slouken@0
    17
.fi
slouken@0
    18
.PP
slouken@0
    19
.SH "STRUCTURE DATA"
slouken@0
    20
.TP 20
slouken@0
    21
\fBfreq\fR
slouken@0
    22
Audio frequency in samples per second
slouken@0
    23
.TP 20
slouken@0
    24
\fBformat\fR
slouken@0
    25
Audio data format
slouken@0
    26
.TP 20
slouken@0
    27
\fBchannels\fR
slouken@0
    28
Number of channels: 1 mono, 2 stereo
slouken@0
    29
.TP 20
slouken@0
    30
\fBsilence\fR
slouken@0
    31
Audio buffer silence value (calculated)
slouken@0
    32
.TP 20
slouken@0
    33
\fBsamples\fR
slouken@0
    34
Audio buffer size in samples
slouken@0
    35
.TP 20
slouken@0
    36
\fBsize\fR
slouken@0
    37
Audio buffer size in bytes (calculated)
slouken@0
    38
.TP 20
slouken@0
    39
\fBcallback(\&.\&.)\fR
slouken@0
    40
Callback function for filling the audio buffer
slouken@0
    41
.TP 20
slouken@0
    42
\fBuserdata\fR
slouken@0
    43
Pointer the user data which is passed to the callback function
slouken@0
    44
.SH "DESCRIPTION"
slouken@0
    45
.PP
slouken@0
    46
The \fBSDL_AudioSpec\fR structure is used to describe the format of some audio data\&. This structure is used by \fI\fBSDL_OpenAudio\fP\fR and \fI\fBSDL_LoadWAV\fP\fR\&. While all fields are used by \fBSDL_OpenAudio\fP only \fBfreq\fR, \fBformat\fR, \fBsamples\fR and \fBchannels\fR are used by \fBSDL_LoadWAV\fP\&. We will detail these common members here\&.
slouken@0
    47
.TP 20
slouken@0
    48
\fBfreq\fR
slouken@0
    49
The number of samples sent to the sound device every second\&. Common values are 11025, 22050 and 44100\&. The higher the better\&.
slouken@0
    50
.TP 20
slouken@0
    51
\fBformat\fR
slouken@0
    52
Specifies the size and type of each sample element 
slouken@0
    53
.IP "\fBAUDIO_U8\fP" 10Unsigned 8-bit samples
slouken@0
    54
.IP "\fBAUDIO_S8\fP" 10Signed 8-bit samples
slouken@0
    55
.IP "\fBAUDIO_U16\fP or \fBAUDIO_U16LSB\fP" 10Unsigned 16-bit little-endian samples
slouken@0
    56
.IP "\fBAUDIO_S16\fP or \fBAUDIO_S16LSB\fP" 10Signed 16-bit little-endian samples
slouken@0
    57
.IP "\fBAUDIO_U16MSB\fP" 10Unsigned 16-bit big-endian samples
slouken@0
    58
.IP "\fBAUDIO_S16MSB\fP" 10Signed 16-bit big-endian samples
slouken@0
    59
.IP "\fBAUDIO_U16SYS\fP" 10Either \fBAUDIO_U16LSB\fP or \fBAUDIO_U16MSB\fP depending on you systems endianness
slouken@0
    60
.IP "\fBAUDIO_S16SYS\fP" 10Either \fBAUDIO_S16LSB\fP or \fBAUDIO_S16MSB\fP depending on you systems endianness
slouken@0
    61
.TP 20
slouken@0
    62
\fBchannels\fR
slouken@0
    63
The number of seperate sound channels\&. 1 is mono (single channel), 2 is stereo (dual channel)\&.
slouken@0
    64
.TP 20
slouken@0
    65
\fBsamples\fR
slouken@0
    66
When used with \fI\fBSDL_OpenAudio\fP\fR this refers to the size of the audio buffer in samples\&. A sample a chunk of audio data of the size specified in \fBformat\fR mulitplied by the number of channels\&. When the \fBSDL_AudioSpec\fR is used with \fI\fBSDL_LoadWAV\fP\fR \fBsamples\fR is set to 4096\&.
slouken@0
    67
.SH "SEE ALSO"
slouken@0
    68
.PP
slouken@0
    69
\fI\fBSDL_OpenAudio\fP\fR, \fI\fBSDL_LoadWAV\fP\fR
slouken@181
    70
...\" created by instant / docbook-to-man, Tue 11 Sep 2001, 22:58