1SDL_AudioSpec(3)               SDL API Reference              SDL_AudioSpec(3)
2
3
4

NAME

6       SDL_AudioSpec - Audio Specification Structure
7

STRUCTURE DEFINITION

9       typedef struct{
10         int freq;
11         Uint16 format;
12         Uint8 channels;
13         Uint8 silence;
14         Uint16 samples;
15         Uint32 size;
16         void (*callback)(void *userdata, Uint8 *stream, int len);
17         void *userdata;
18       } SDL_AudioSpec;
19

STRUCTURE DATA

21       freq                Audio frequency in samples per second
22
23       format              Audio data format
24
25       channels            Number of channels: 1 mono, 2 stereo
26
27       silence             Audio buffer silence value (calculated)
28
29       samples             Audio buffer size in samples
30
31       size                Audio buffer size in bytes (calculated)
32
33       callback(..)        Callback function for filling the audio buffer
34
35       userdata            Pointer  the user data which is passed to the call‐
36                           back function
37

DESCRIPTION

39       The SDL_AudioSpec structure is used to  describe  the  format  of  some
40       audio  data.  This  structure is used by SDL_OpenAudio and SDL_LoadWAV.
41       While all fields are used by SDL_OpenAudio only freq,  format,  samples
42       and  channels are used by SDL_LoadWAV. We will detail these common mem‐
43       bers here.
44
45       freq                The number of samples  sent  to  the  sound  device
46                           every  second.  Common  values are 11025, 22050 and
47                           44100. The higher the better.
48
49       format              Specifies the size and type of each sample element
50
51       AUDIO_U8
52
53       AUDIO_S8
54
55       AUDIO_U16 or AUDIO_U16LSB
56
57       AUDIO_S16 or AUDIO_S16LSB
58
59       AUDIO_U16MSB
60
61       AUDIO_S16MSB
62
63       AUDIO_U16SYS
64
65       AUDIO_S16SYS
66
67       channels            The number of seperate sound channels.  1  is  mono
68                           (single channel), 2 is stereo (dual channel).
69
70       samples             When  used  with  SDL_OpenAudio  this refers to the
71                           size of the audio buffer in  samples.  A  sample  a
72                           chunk of audio data of the size specified in format
73                           mulitplied by the  number  of  channels.  When  the
74                           SDL_AudioSpec  is  used with SDL_LoadWAV samples is
75                           set to 4096.
76

SEE ALSO

78       SDL_OpenAudio, SDL_LoadWAV
79
80
81
82SDL                         Tue 11 Sep 2001, 22:58            SDL_AudioSpec(3)
Impressum