Mercurial > sdl-ios-xcode
annotate docs/html/sdlcdtrack.html @ 773:da0a2ad35bf4
Date: Sun, 4 Jan 2004 23:48:19 +0100
From: Max Horn
Subject: Re: Again Audio CD patch
Am 04.01.2004 um 22:38 schrieb Sam Lantinga:
>
> Okay, I fixed the buffering problems by simply using a 4 second buffer
> instead of a 1 second buffer. However, using your code I can't play an
> entire CD - the playback stops after the first song.
>
Found the problem: FSReadFork returns eofErr when the file is finished.
However, we check its return value for errors, and if anything but
noErr occurs, the reader thread aborts its current iteration. That is
bad, because it aborts before it can ever set the flag which tells that
the file is over (also, any remaining data which FSRead did return is
lost - so you'd not hear about to 4 seconds from the end of the file.
Furthermore, the computed data size was 8 bytes to high (I forgot to
account for the fact that the size of an (A)IFF chunk always contains
the chunk header & size fields, too). This is enough to make it work.
However, the end condition is rather fragile, so I tuned some other
things to be pessimistic (check for <= 0 instead of == 0, when eofErr
is encountered enforce mReadFilePosition == mFileLength). You never
know...
The attached patch fixes the issue for me.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 05 Jan 2004 00:57:51 +0000 (2004-01-05) |
parents | e5bc29de3f0a |
children | 355632dca928 |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_CDtrack</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="CD-ROM" | |
14 HREF="cdrom.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_CD" | |
17 HREF="sdlcd.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="Multi-threaded Programming" | |
20 HREF="thread.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="sdlcd.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="thread.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="SDLCDTRACK" | |
71 >SDL_CDtrack</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="AEN7240" |
0 | 77 ></A |
78 ><H2 | |
79 >Name</H2 | |
80 >SDL_CDtrack -- CD Track Information Structure</DIV | |
81 ><DIV | |
82 CLASS="REFSECT1" | |
83 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
84 NAME="AEN7243" |
0 | 85 ></A |
86 ><H2 | |
87 >Structure Definition</H2 | |
88 ><PRE | |
89 CLASS="PROGRAMLISTING" | |
90 >typedef struct{ | |
91 Uint8 id; | |
92 Uint8 type; | |
93 Uint32 length; | |
94 Uint32 offset; | |
95 } SDL_CDtrack;</PRE | |
96 ></DIV | |
97 ><DIV | |
98 CLASS="REFSECT1" | |
99 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
100 NAME="AEN7246" |
0 | 101 ></A |
102 ><H2 | |
103 >Structure Data</H2 | |
104 ><DIV | |
105 CLASS="INFORMALTABLE" | |
106 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
107 NAME="AEN7248" |
0 | 108 ></A |
109 ><P | |
110 ></P | |
111 ><TABLE | |
112 BORDER="0" | |
113 CLASS="CALSTABLE" | |
114 ><TBODY | |
115 ><TR | |
116 ><TD | |
117 ALIGN="LEFT" | |
118 VALIGN="TOP" | |
119 ><TT | |
120 CLASS="STRUCTFIELD" | |
121 ><I | |
122 >id</I | |
123 ></TT | |
124 ></TD | |
125 ><TD | |
126 ALIGN="LEFT" | |
127 VALIGN="TOP" | |
128 >Track number (0-99)</TD | |
129 ></TR | |
130 ><TR | |
131 ><TD | |
132 ALIGN="LEFT" | |
133 VALIGN="TOP" | |
134 ><TT | |
135 CLASS="STRUCTFIELD" | |
136 ><I | |
137 >type</I | |
138 ></TT | |
139 ></TD | |
140 ><TD | |
141 ALIGN="LEFT" | |
142 VALIGN="TOP" | |
143 ><TT | |
144 CLASS="LITERAL" | |
145 >SDL_AUDIO_TRACK</TT | |
146 > or <TT | |
147 CLASS="LITERAL" | |
148 >SDL_DATA_TRACK</TT | |
149 ></TD | |
150 ></TR | |
151 ><TR | |
152 ><TD | |
153 ALIGN="LEFT" | |
154 VALIGN="TOP" | |
155 ><TT | |
156 CLASS="STRUCTFIELD" | |
157 ><I | |
158 >length</I | |
159 ></TT | |
160 ></TD | |
161 ><TD | |
162 ALIGN="LEFT" | |
163 VALIGN="TOP" | |
164 >Length, in frames, of this track</TD | |
165 ></TR | |
166 ><TR | |
167 ><TD | |
168 ALIGN="LEFT" | |
169 VALIGN="TOP" | |
170 ><TT | |
171 CLASS="STRUCTFIELD" | |
172 ><I | |
173 >offset</I | |
174 ></TT | |
175 ></TD | |
176 ><TD | |
177 ALIGN="LEFT" | |
178 VALIGN="TOP" | |
179 >Frame offset to the beginning of this track</TD | |
180 ></TR | |
181 ></TBODY | |
182 ></TABLE | |
183 ><P | |
184 ></P | |
185 ></DIV | |
186 ></DIV | |
187 ><DIV | |
188 CLASS="REFSECT1" | |
189 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
190 NAME="AEN7269" |
0 | 191 ></A |
192 ><H2 | |
193 >Description</H2 | |
194 ><P | |
195 ><SPAN | |
196 CLASS="STRUCTNAME" | |
197 >SDL_CDtrack</SPAN | |
198 > stores data on each track on a CD, its fields should be pretty self explainatory. It is a member a the <A | |
199 HREF="sdlcd.html" | |
200 ><SPAN | |
201 CLASS="STRUCTNAME" | |
202 >SDL_CD</SPAN | |
203 ></A | |
204 > structure.</P | |
205 ><DIV | |
206 CLASS="NOTE" | |
207 ><BLOCKQUOTE | |
208 CLASS="NOTE" | |
209 ><P | |
210 ><B | |
211 >Note: </B | |
212 >Frames can be converted to standard timings. There are <TT | |
213 CLASS="LITERAL" | |
214 >CD_FPS</TT | |
215 > frames per second, so <SPAN | |
216 CLASS="STRUCTNAME" | |
217 >SDL_CDtrack</SPAN | |
218 >.<TT | |
219 CLASS="STRUCTFIELD" | |
220 ><I | |
221 >length</I | |
222 ></TT | |
223 >/<TT | |
224 CLASS="LITERAL" | |
225 >CD_FPS</TT | |
226 >=length_in_seconds.</P | |
227 ></BLOCKQUOTE | |
228 ></DIV | |
229 ></DIV | |
230 ><DIV | |
231 CLASS="REFSECT1" | |
232 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
233 NAME="AEN7281" |
0 | 234 ></A |
235 ><H2 | |
236 >See Also</H2 | |
237 ><P | |
238 ><A | |
239 HREF="sdlcd.html" | |
240 ><SPAN | |
241 CLASS="STRUCTNAME" | |
242 >SDL_CD</SPAN | |
243 ></A | |
244 ></P | |
245 ></DIV | |
246 ><DIV | |
247 CLASS="NAVFOOTER" | |
248 ><HR | |
249 ALIGN="LEFT" | |
250 WIDTH="100%"><TABLE | |
251 WIDTH="100%" | |
252 BORDER="0" | |
253 CELLPADDING="0" | |
254 CELLSPACING="0" | |
255 ><TR | |
256 ><TD | |
257 WIDTH="33%" | |
258 ALIGN="left" | |
259 VALIGN="top" | |
260 ><A | |
261 HREF="sdlcd.html" | |
262 >Prev</A | |
263 ></TD | |
264 ><TD | |
265 WIDTH="34%" | |
266 ALIGN="center" | |
267 VALIGN="top" | |
268 ><A | |
269 HREF="index.html" | |
270 >Home</A | |
271 ></TD | |
272 ><TD | |
273 WIDTH="33%" | |
274 ALIGN="right" | |
275 VALIGN="top" | |
276 ><A | |
277 HREF="thread.html" | |
278 >Next</A | |
279 ></TD | |
280 ></TR | |
281 ><TR | |
282 ><TD | |
283 WIDTH="33%" | |
284 ALIGN="left" | |
285 VALIGN="top" | |
286 >SDL_CD</TD | |
287 ><TD | |
288 WIDTH="34%" | |
289 ALIGN="center" | |
290 VALIGN="top" | |
291 ><A | |
292 HREF="cdrom.html" | |
293 >Up</A | |
294 ></TD | |
295 ><TD | |
296 WIDTH="33%" | |
297 ALIGN="right" | |
298 VALIGN="top" | |
299 >Multi-threaded Programming</TD | |
300 ></TR | |
301 ></TABLE | |
302 ></DIV | |
303 ></BODY | |
304 ></HTML | |
305 > |