version 2, including all changes.
.
| Rev |
Author |
# |
Line |
| 2 |
perry |
1 |
SDL_!AudioSpec |
| |
|
2 |
!!!SDL_!AudioSpec |
| 1 |
perry |
3 |
NAME |
| |
|
4 |
STRUCTURE DEFINITION |
| |
|
5 |
STRUCTURE DATA |
| |
|
6 |
DESCRIPTION |
| |
|
7 |
SEE ALSO |
| |
|
8 |
---- |
| |
|
9 |
!!NAME |
| |
|
10 |
|
| |
|
11 |
|
| 2 |
perry |
12 |
SDL_!AudioSpec- Audio Specification Structure |
| 1 |
perry |
13 |
!!STRUCTURE DEFINITION |
| |
|
14 |
|
| |
|
15 |
|
| |
|
16 |
typedef struct{ |
| |
|
17 |
int freq; |
| |
|
18 |
Uint16 format; |
| |
|
19 |
Uint8 channels; |
| |
|
20 |
Uint8 silence; |
| |
|
21 |
Uint16 samples; |
| |
|
22 |
Uint32 size; |
| |
|
23 |
void (*callback)(void *userdata, Uint8 *stream, int len); |
| |
|
24 |
void *userdata; |
| 2 |
perry |
25 |
} SDL_!AudioSpec; |
| 1 |
perry |
26 |
!!STRUCTURE DATA |
| |
|
27 |
|
| |
|
28 |
|
| |
|
29 |
__freq__ Audio frequency in samples per |
| |
|
30 |
second |
| |
|
31 |
|
| |
|
32 |
|
| |
|
33 |
__format__ Audio data format |
| |
|
34 |
|
| |
|
35 |
|
| |
|
36 |
__channels__ Number of channels: 1 mono, 2 |
| |
|
37 |
stereo |
| |
|
38 |
|
| |
|
39 |
|
| |
|
40 |
__silence__ Audio buffer silence value |
| |
|
41 |
(calculated) |
| |
|
42 |
|
| |
|
43 |
|
| |
|
44 |
__samples__ Audio buffer size in samples |
| |
|
45 |
|
| |
|
46 |
|
| |
|
47 |
__size__ Audio buffer size in bytes |
| |
|
48 |
(calculated) |
| |
|
49 |
|
| |
|
50 |
|
| |
|
51 |
__callback(..)__ Callback function for filling the audio |
| |
|
52 |
buffer |
| |
|
53 |
|
| |
|
54 |
|
| |
|
55 |
__userdata__ Pointer the user data which is passed to the |
| |
|
56 |
callback function |
| |
|
57 |
!!DESCRIPTION |
| |
|
58 |
|
| |
|
59 |
|
| 2 |
perry |
60 |
The __SDL_!AudioSpec__ structure is used to describe the |
| 1 |
perry |
61 |
format of some audio data. This structure is used by |
| 2 |
perry |
62 |
__SDL_!OpenAudio__ and __SDL_LoadWAV__. While all |
| |
|
63 |
fields are used by __SDL_!OpenAudio__ only __freq__, |
| 1 |
perry |
64 |
__format__, __samples__ and __channels__ are used |
| |
|
65 |
by __SDL_LoadWAV__. We will detail these common members |
| |
|
66 |
here. |
| |
|
67 |
|
| |
|
68 |
|
| |
|
69 |
__freq__ The number of samples sent to the sound device |
| |
|
70 |
every second. Common values are 11025, 22050 and 44100. The |
| |
|
71 |
higher the better. |
| |
|
72 |
|
| |
|
73 |
|
| |
|
74 |
__format__ Specifies the size and type of each sample |
| |
|
75 |
element |
| |
|
76 |
|
| |
|
77 |
|
| |
|
78 |
__AUDIO_U8__ |
| |
|
79 |
|
| |
|
80 |
|
| |
|
81 |
__AUDIO_S8__ |
| |
|
82 |
|
| |
|
83 |
|
| |
|
84 |
__AUDIO_U16__ or __AUDIO_U16LSB__ |
| |
|
85 |
|
| |
|
86 |
|
| |
|
87 |
__AUDIO_S16__ or __AUDIO_S16LSB__ |
| |
|
88 |
|
| |
|
89 |
|
| |
|
90 |
__AUDIO_U16MSB__ |
| |
|
91 |
|
| |
|
92 |
|
| |
|
93 |
__AUDIO_S16MSB__ |
| |
|
94 |
|
| |
|
95 |
|
| |
|
96 |
__AUDIO_U16SYS__ |
| |
|
97 |
|
| |
|
98 |
|
| |
|
99 |
__AUDIO_S16SYS__ |
| |
|
100 |
|
| |
|
101 |
|
| |
|
102 |
__channels__ The number of seperate sound channels. 1 is |
| |
|
103 |
mono (single channel), 2 is stereo (dual |
| |
|
104 |
channel). |
| |
|
105 |
|
| |
|
106 |
|
| 2 |
perry |
107 |
__samples__ When used with __SDL_!OpenAudio__ this |
| 1 |
perry |
108 |
refers to the size of the audio buffer in samples. A sample |
| |
|
109 |
a chunk of audio data of the size specified in __format__ |
| |
|
110 |
mulitplied by the number of channels. When the |
| 2 |
perry |
111 |
__SDL_!AudioSpec__ is used with __SDL_LoadWAV samples__ |
| 1 |
perry |
112 |
is set to 4096. |
| |
|
113 |
!!SEE ALSO |
| |
|
114 |
|
| |
|
115 |
|
| 2 |
perry |
116 |
__SDL_!OpenAudio__, __SDL_LoadWAV__ |
| 1 |
perry |
117 |
---- |