Mercurial > sdl-ios-xcode
annotate docs/html/sdlloadwav.html @ 302:8a86bdf34f0f
Added Atari joystick support (thanks Patrice!)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 07 Mar 2002 20:23:11 +0000 |
parents | e5bc29de3f0a |
children | 355632dca928 |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_LoadWAV</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.64 |
0 | 8 "><LINK |
9 REL="HOME" | |
10 TITLE="SDL Library Documentation" | |
11 HREF="index.html"><LINK | |
12 REL="UP" | |
13 TITLE="Audio" | |
14 HREF="audio.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_GetAudioStatus" | |
17 HREF="sdlgetaudiostatus.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_FreeWAV" | |
20 HREF="sdlfreewav.html"></HEAD | |
21 ><BODY | |
22 CLASS="REFENTRY" | |
23 BGCOLOR="#FFF8DC" | |
24 TEXT="#000000" | |
25 LINK="#0000ee" | |
26 VLINK="#551a8b" | |
27 ALINK="#ff0000" | |
28 ><DIV | |
29 CLASS="NAVHEADER" | |
30 ><TABLE | |
31 WIDTH="100%" | |
32 BORDER="0" | |
33 CELLPADDING="0" | |
34 CELLSPACING="0" | |
35 ><TR | |
36 ><TH | |
37 COLSPAN="3" | |
38 ALIGN="center" | |
39 >SDL Library Documentation</TH | |
40 ></TR | |
41 ><TR | |
42 ><TD | |
43 WIDTH="10%" | |
44 ALIGN="left" | |
45 VALIGN="bottom" | |
46 ><A | |
47 HREF="sdlgetaudiostatus.html" | |
48 >Prev</A | |
49 ></TD | |
50 ><TD | |
51 WIDTH="80%" | |
52 ALIGN="center" | |
53 VALIGN="bottom" | |
54 ></TD | |
55 ><TD | |
56 WIDTH="10%" | |
57 ALIGN="right" | |
58 VALIGN="bottom" | |
59 ><A | |
60 HREF="sdlfreewav.html" | |
61 >Next</A | |
62 ></TD | |
63 ></TR | |
64 ></TABLE | |
65 ><HR | |
66 ALIGN="LEFT" | |
67 WIDTH="100%"></DIV | |
68 ><H1 | |
69 ><A | |
70 NAME="SDLLOADWAV" | |
71 >SDL_LoadWAV</A | |
72 ></H1 | |
73 ><DIV | |
74 CLASS="REFNAMEDIV" | |
75 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
76 NAME="AEN6428" |
0 | 77 ></A |
78 ><H2 | |
79 >Name</H2 | |
80 >SDL_LoadWAV -- Load a WAVE file</DIV | |
81 ><DIV | |
82 CLASS="REFSYNOPSISDIV" | |
83 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
84 NAME="AEN6431" |
0 | 85 ></A |
86 ><H2 | |
87 >Synopsis</H2 | |
88 ><DIV | |
89 CLASS="FUNCSYNOPSIS" | |
90 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
91 NAME="AEN6432" |
0 | 92 ></A |
93 ><P | |
94 ></P | |
95 ><PRE | |
96 CLASS="FUNCSYNOPSISINFO" | |
97 >#include "SDL.h"</PRE | |
98 ><P | |
99 ><CODE | |
100 ><CODE | |
101 CLASS="FUNCDEF" | |
102 >SDL_AudioSpec *<B | |
103 CLASS="FSFUNC" | |
104 >SDL_LoadWAV</B | |
105 ></CODE | |
106 >(const char *file, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);</CODE | |
107 ></P | |
108 ><P | |
109 ></P | |
110 ></DIV | |
111 ></DIV | |
112 ><DIV | |
113 CLASS="REFSECT1" | |
114 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
115 NAME="AEN6438" |
0 | 116 ></A |
117 ><H2 | |
118 >Description</H2 | |
119 ><P | |
120 ><TT | |
121 CLASS="FUNCTION" | |
122 >SDL_LoadWAV</TT | |
123 > | |
124 This function loads a WAVE <TT | |
125 CLASS="PARAMETER" | |
126 ><I | |
127 >file</I | |
128 ></TT | |
129 > into memory.</P | |
130 ><P | |
131 >If this function succeeds, it returns the given | |
132 <A | |
133 HREF="sdlaudiospec.html" | |
134 ><TT | |
135 CLASS="FUNCTION" | |
136 >SDL_AudioSpec</TT | |
137 ></A | |
138 >, | |
139 filled with the audio data format of the wave data, and sets | |
140 <TT | |
141 CLASS="PARAMETER" | |
142 ><I | |
143 >audio_buf</I | |
144 ></TT | |
145 > to a <TT | |
146 CLASS="FUNCTION" | |
147 >malloc</TT | |
148 >'d | |
149 buffer containing the audio data, and sets <TT | |
150 CLASS="PARAMETER" | |
151 ><I | |
152 >audio_len</I | |
153 ></TT | |
154 > | |
155 to the length of that audio buffer, in bytes. You need to free the audio | |
156 buffer with <A | |
157 HREF="sdlfreewav.html" | |
158 ><TT | |
159 CLASS="FUNCTION" | |
160 >SDL_FreeWAV</TT | |
161 ></A | |
162 > when you are | |
163 done with it.</P | |
164 ><P | |
165 >This function returns <TT | |
166 CLASS="LITERAL" | |
167 >NULL</TT | |
168 > and sets the SDL | |
169 error message if the wave file cannot be opened, uses an unknown data format, | |
170 or is corrupt. Currently raw, MS-ADPCM and IMA-ADPCM WAVE files are supported.</P | |
171 ></DIV | |
172 ><DIV | |
173 CLASS="REFSECT1" | |
174 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
175 NAME="AEN6453" |
0 | 176 ></A |
177 ><H2 | |
178 >Example</H2 | |
179 ><PRE | |
180 CLASS="PROGRAMLISTING" | |
181 >SDL_AudioSpec wav_spec; | |
182 Uint32 wav_length; | |
183 Uint8 *wav_buffer; | |
184 | |
185 /* Load the WAV */ | |
186 if( SDL_LoadWAV("test.wav", &wav_spec, &wav_buffer, &wav_length) == NULL ){ | |
187 fprintf(stderr, "Could not open test.wav: %s\n", SDL_GetError()); | |
188 exit(-1); | |
189 } | |
190 . | |
191 . | |
192 . | |
193 /* Do stuff with the WAV */ | |
194 . | |
195 . | |
196 /* Free It */ | |
197 SDL_FreeWAV(wav_buffer);</PRE | |
198 ></DIV | |
199 ><DIV | |
200 CLASS="REFSECT1" | |
201 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
202 NAME="AEN6456" |
0 | 203 ></A |
204 ><H2 | |
205 >See Also</H2 | |
206 ><P | |
207 ><A | |
208 HREF="sdlaudiospec.html" | |
209 ><SPAN | |
210 CLASS="STRUCTNAME" | |
211 >SDL_AudioSpec</SPAN | |
212 ></A | |
213 >, | |
214 <A | |
215 HREF="sdlopenaudio.html" | |
216 ><TT | |
217 CLASS="FUNCTION" | |
218 >SDL_OpenAudio</TT | |
219 ></A | |
220 >, | |
221 <A | |
222 HREF="sdlfreewav.html" | |
223 ><TT | |
224 CLASS="FUNCTION" | |
225 >SDL_FreeWAV</TT | |
226 ></A | |
227 ></P | |
228 ></DIV | |
229 ><DIV | |
230 CLASS="NAVFOOTER" | |
231 ><HR | |
232 ALIGN="LEFT" | |
233 WIDTH="100%"><TABLE | |
234 WIDTH="100%" | |
235 BORDER="0" | |
236 CELLPADDING="0" | |
237 CELLSPACING="0" | |
238 ><TR | |
239 ><TD | |
240 WIDTH="33%" | |
241 ALIGN="left" | |
242 VALIGN="top" | |
243 ><A | |
244 HREF="sdlgetaudiostatus.html" | |
245 >Prev</A | |
246 ></TD | |
247 ><TD | |
248 WIDTH="34%" | |
249 ALIGN="center" | |
250 VALIGN="top" | |
251 ><A | |
252 HREF="index.html" | |
253 >Home</A | |
254 ></TD | |
255 ><TD | |
256 WIDTH="33%" | |
257 ALIGN="right" | |
258 VALIGN="top" | |
259 ><A | |
260 HREF="sdlfreewav.html" | |
261 >Next</A | |
262 ></TD | |
263 ></TR | |
264 ><TR | |
265 ><TD | |
266 WIDTH="33%" | |
267 ALIGN="left" | |
268 VALIGN="top" | |
269 >SDL_GetAudioStatus</TD | |
270 ><TD | |
271 WIDTH="34%" | |
272 ALIGN="center" | |
273 VALIGN="top" | |
274 ><A | |
275 HREF="audio.html" | |
276 >Up</A | |
277 ></TD | |
278 ><TD | |
279 WIDTH="33%" | |
280 ALIGN="right" | |
281 VALIGN="top" | |
282 >SDL_FreeWAV</TD | |
283 ></TR | |
284 ></TABLE | |
285 ></DIV | |
286 ></BODY | |
287 ></HTML | |
288 > |