Mercurial > sdl-ios-xcode
annotate docs/html/sdlloadwav.html @ 3261:72b542f34739
The new, cleaner, version of the atomic operations. The dummy code is what you should start working with to port atomic ops.
The linux code appears to be complete and *should* be the base of all Unix and GCC based versions. The macosx and win32 versions
are currently just copies of the dummy code. I will begin working on the windows version as soon as this check in is done. I
need someone to work on the Mac OS X version.
I'm afraid that this check in will break QNX (Sorry!)
author | Bob Pendleton <bob@pendleton.com> |
---|---|
date | Thu, 17 Sep 2009 20:35:12 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_LoadWAV</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ |
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 | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
31 SUMMARY="Header navigation table" |
0 | 32 WIDTH="100%" |
33 BORDER="0" | |
34 CELLPADDING="0" | |
35 CELLSPACING="0" | |
36 ><TR | |
37 ><TH | |
38 COLSPAN="3" | |
39 ALIGN="center" | |
40 >SDL Library Documentation</TH | |
41 ></TR | |
42 ><TR | |
43 ><TD | |
44 WIDTH="10%" | |
45 ALIGN="left" | |
46 VALIGN="bottom" | |
47 ><A | |
48 HREF="sdlgetaudiostatus.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
49 ACCESSKEY="P" |
0 | 50 >Prev</A |
51 ></TD | |
52 ><TD | |
53 WIDTH="80%" | |
54 ALIGN="center" | |
55 VALIGN="bottom" | |
56 ></TD | |
57 ><TD | |
58 WIDTH="10%" | |
59 ALIGN="right" | |
60 VALIGN="bottom" | |
61 ><A | |
62 HREF="sdlfreewav.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
63 ACCESSKEY="N" |
0 | 64 >Next</A |
65 ></TD | |
66 ></TR | |
67 ></TABLE | |
68 ><HR | |
69 ALIGN="LEFT" | |
70 WIDTH="100%"></DIV | |
71 ><H1 | |
72 ><A | |
73 NAME="SDLLOADWAV" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
74 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
75 >SDL_LoadWAV</H1 |
0 | 76 ><DIV |
77 CLASS="REFNAMEDIV" | |
78 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
79 NAME="AEN6816" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_LoadWAV -- Load a WAVE file</DIV | |
84 ><DIV | |
85 CLASS="REFSYNOPSISDIV" | |
86 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
87 NAME="AEN6819" |
0 | 88 ></A |
89 ><H2 | |
90 >Synopsis</H2 | |
91 ><DIV | |
92 CLASS="FUNCSYNOPSIS" | |
93 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
94 NAME="AEN6820" |
0 | 95 ></A |
96 ><P | |
97 ></P | |
98 ><PRE | |
99 CLASS="FUNCSYNOPSISINFO" | |
100 >#include "SDL.h"</PRE | |
101 ><P | |
102 ><CODE | |
103 ><CODE | |
104 CLASS="FUNCDEF" | |
105 >SDL_AudioSpec *<B | |
106 CLASS="FSFUNC" | |
107 >SDL_LoadWAV</B | |
108 ></CODE | |
109 >(const char *file, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);</CODE | |
110 ></P | |
111 ><P | |
112 ></P | |
113 ></DIV | |
114 ></DIV | |
115 ><DIV | |
116 CLASS="REFSECT1" | |
117 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
118 NAME="AEN6826" |
0 | 119 ></A |
120 ><H2 | |
121 >Description</H2 | |
122 ><P | |
123 ><TT | |
124 CLASS="FUNCTION" | |
125 >SDL_LoadWAV</TT | |
126 > | |
127 This function loads a WAVE <TT | |
128 CLASS="PARAMETER" | |
129 ><I | |
130 >file</I | |
131 ></TT | |
132 > into memory.</P | |
133 ><P | |
134 >If this function succeeds, it returns the given | |
135 <A | |
136 HREF="sdlaudiospec.html" | |
137 ><TT | |
138 CLASS="FUNCTION" | |
139 >SDL_AudioSpec</TT | |
140 ></A | |
141 >, | |
142 filled with the audio data format of the wave data, and sets | |
143 <TT | |
144 CLASS="PARAMETER" | |
145 ><I | |
146 >audio_buf</I | |
147 ></TT | |
148 > to a <TT | |
149 CLASS="FUNCTION" | |
150 >malloc</TT | |
151 >'d | |
152 buffer containing the audio data, and sets <TT | |
153 CLASS="PARAMETER" | |
154 ><I | |
155 >audio_len</I | |
156 ></TT | |
157 > | |
158 to the length of that audio buffer, in bytes. You need to free the audio | |
159 buffer with <A | |
160 HREF="sdlfreewav.html" | |
161 ><TT | |
162 CLASS="FUNCTION" | |
163 >SDL_FreeWAV</TT | |
164 ></A | |
165 > when you are | |
166 done with it.</P | |
167 ><P | |
168 >This function returns <TT | |
169 CLASS="LITERAL" | |
170 >NULL</TT | |
171 > and sets the SDL | |
172 error message if the wave file cannot be opened, uses an unknown data format, | |
173 or is corrupt. Currently raw, MS-ADPCM and IMA-ADPCM WAVE files are supported.</P | |
174 ></DIV | |
175 ><DIV | |
176 CLASS="REFSECT1" | |
177 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
178 NAME="AEN6841" |
0 | 179 ></A |
180 ><H2 | |
181 >Example</H2 | |
182 ><PRE | |
183 CLASS="PROGRAMLISTING" | |
184 >SDL_AudioSpec wav_spec; | |
185 Uint32 wav_length; | |
186 Uint8 *wav_buffer; | |
187 | |
188 /* Load the WAV */ | |
189 if( SDL_LoadWAV("test.wav", &wav_spec, &wav_buffer, &wav_length) == NULL ){ | |
190 fprintf(stderr, "Could not open test.wav: %s\n", SDL_GetError()); | |
191 exit(-1); | |
192 } | |
193 . | |
194 . | |
195 . | |
196 /* Do stuff with the WAV */ | |
197 . | |
198 . | |
199 /* Free It */ | |
200 SDL_FreeWAV(wav_buffer);</PRE | |
201 ></DIV | |
202 ><DIV | |
203 CLASS="REFSECT1" | |
204 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
205 NAME="AEN6844" |
0 | 206 ></A |
207 ><H2 | |
208 >See Also</H2 | |
209 ><P | |
210 ><A | |
211 HREF="sdlaudiospec.html" | |
212 ><SPAN | |
213 CLASS="STRUCTNAME" | |
214 >SDL_AudioSpec</SPAN | |
215 ></A | |
216 >, | |
217 <A | |
218 HREF="sdlopenaudio.html" | |
219 ><TT | |
220 CLASS="FUNCTION" | |
221 >SDL_OpenAudio</TT | |
222 ></A | |
223 >, | |
224 <A | |
225 HREF="sdlfreewav.html" | |
226 ><TT | |
227 CLASS="FUNCTION" | |
228 >SDL_FreeWAV</TT | |
229 ></A | |
230 ></P | |
231 ></DIV | |
232 ><DIV | |
233 CLASS="NAVFOOTER" | |
234 ><HR | |
235 ALIGN="LEFT" | |
236 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
237 SUMMARY="Footer navigation table" |
0 | 238 WIDTH="100%" |
239 BORDER="0" | |
240 CELLPADDING="0" | |
241 CELLSPACING="0" | |
242 ><TR | |
243 ><TD | |
244 WIDTH="33%" | |
245 ALIGN="left" | |
246 VALIGN="top" | |
247 ><A | |
248 HREF="sdlgetaudiostatus.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
249 ACCESSKEY="P" |
0 | 250 >Prev</A |
251 ></TD | |
252 ><TD | |
253 WIDTH="34%" | |
254 ALIGN="center" | |
255 VALIGN="top" | |
256 ><A | |
257 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
258 ACCESSKEY="H" |
0 | 259 >Home</A |
260 ></TD | |
261 ><TD | |
262 WIDTH="33%" | |
263 ALIGN="right" | |
264 VALIGN="top" | |
265 ><A | |
266 HREF="sdlfreewav.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
267 ACCESSKEY="N" |
0 | 268 >Next</A |
269 ></TD | |
270 ></TR | |
271 ><TR | |
272 ><TD | |
273 WIDTH="33%" | |
274 ALIGN="left" | |
275 VALIGN="top" | |
276 >SDL_GetAudioStatus</TD | |
277 ><TD | |
278 WIDTH="34%" | |
279 ALIGN="center" | |
280 VALIGN="top" | |
281 ><A | |
282 HREF="audio.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
283 ACCESSKEY="U" |
0 | 284 >Up</A |
285 ></TD | |
286 ><TD | |
287 WIDTH="33%" | |
288 ALIGN="right" | |
289 VALIGN="top" | |
290 >SDL_FreeWAV</TD | |
291 ></TR | |
292 ></TABLE | |
293 ></DIV | |
294 ></BODY | |
295 ></HTML | |
296 > |