Mercurial > sdl-ios-xcode
annotate docs/html/sdlrect.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 |
parents | e5bc29de3f0a |
children | 355632dca928 |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_Rect</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="Video" | |
14 HREF="video.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_GLattr" | |
17 HREF="sdlglattr.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_Color" | |
20 HREF="sdlcolor.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="sdlglattr.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="sdlcolor.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="SDLRECT" | |
71 >SDL_Rect</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="AEN2662" |
0 | 77 ></A |
78 ><H2 | |
79 >Name</H2 | |
80 >SDL_Rect -- Defines a rectangular area</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="AEN2665" |
0 | 85 ></A |
86 ><H2 | |
87 >Structure Definition</H2 | |
88 ><PRE | |
89 CLASS="PROGRAMLISTING" | |
90 >typedef struct{ | |
91 Sint16 x, y; | |
92 Uint16 w, h; | |
93 } SDL_Rect;</PRE | |
94 ></DIV | |
95 ><DIV | |
96 CLASS="REFSECT1" | |
97 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
98 NAME="AEN2668" |
0 | 99 ></A |
100 ><H2 | |
101 >Structure Data</H2 | |
102 ><DIV | |
103 CLASS="INFORMALTABLE" | |
104 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
105 NAME="AEN2670" |
0 | 106 ></A |
107 ><P | |
108 ></P | |
109 ><TABLE | |
110 BORDER="0" | |
111 CLASS="CALSTABLE" | |
112 ><TBODY | |
113 ><TR | |
114 ><TD | |
115 ALIGN="LEFT" | |
116 VALIGN="TOP" | |
117 ><TT | |
118 CLASS="STRUCTFIELD" | |
119 ><I | |
120 >x, y</I | |
121 ></TT | |
122 ></TD | |
123 ><TD | |
124 ALIGN="LEFT" | |
125 VALIGN="TOP" | |
126 >Position of the upper-left corner of the rectangle</TD | |
127 ></TR | |
128 ><TR | |
129 ><TD | |
130 ALIGN="LEFT" | |
131 VALIGN="TOP" | |
132 ><TT | |
133 CLASS="STRUCTFIELD" | |
134 ><I | |
135 >w, h</I | |
136 ></TT | |
137 ></TD | |
138 ><TD | |
139 ALIGN="LEFT" | |
140 VALIGN="TOP" | |
141 >The width and height of the rectangle</TD | |
142 ></TR | |
143 ></TBODY | |
144 ></TABLE | |
145 ><P | |
146 ></P | |
147 ></DIV | |
148 ></DIV | |
149 ><DIV | |
150 CLASS="REFSECT1" | |
151 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
152 NAME="AEN2681" |
0 | 153 ></A |
154 ><H2 | |
155 >Description</H2 | |
156 ><P | |
157 >A <SPAN | |
158 CLASS="STRUCTNAME" | |
159 >SDL_Rect</SPAN | |
160 > defines a rectangular area of pixels. It is used by <A | |
161 HREF="sdlblitsurface.html" | |
162 ><TT | |
163 CLASS="FUNCTION" | |
164 >SDL_BlitSurface</TT | |
165 ></A | |
166 > to define blitting regions and by several other video functions.</P | |
167 ></DIV | |
168 ><DIV | |
169 CLASS="REFSECT1" | |
170 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
171 NAME="AEN2687" |
0 | 172 ></A |
173 ><H2 | |
174 >See Also</H2 | |
175 ><P | |
176 ><A | |
177 HREF="sdlblitsurface.html" | |
178 ><TT | |
179 CLASS="FUNCTION" | |
180 >SDL_BlitSurface</TT | |
181 ></A | |
182 >, | |
183 <A | |
184 HREF="sdlupdaterect.html" | |
185 ><TT | |
186 CLASS="FUNCTION" | |
187 >SDL_UpdateRect</TT | |
188 ></A | |
189 ></P | |
190 ></DIV | |
191 ><DIV | |
192 CLASS="NAVFOOTER" | |
193 ><HR | |
194 ALIGN="LEFT" | |
195 WIDTH="100%"><TABLE | |
196 WIDTH="100%" | |
197 BORDER="0" | |
198 CELLPADDING="0" | |
199 CELLSPACING="0" | |
200 ><TR | |
201 ><TD | |
202 WIDTH="33%" | |
203 ALIGN="left" | |
204 VALIGN="top" | |
205 ><A | |
206 HREF="sdlglattr.html" | |
207 >Prev</A | |
208 ></TD | |
209 ><TD | |
210 WIDTH="34%" | |
211 ALIGN="center" | |
212 VALIGN="top" | |
213 ><A | |
214 HREF="index.html" | |
215 >Home</A | |
216 ></TD | |
217 ><TD | |
218 WIDTH="33%" | |
219 ALIGN="right" | |
220 VALIGN="top" | |
221 ><A | |
222 HREF="sdlcolor.html" | |
223 >Next</A | |
224 ></TD | |
225 ></TR | |
226 ><TR | |
227 ><TD | |
228 WIDTH="33%" | |
229 ALIGN="left" | |
230 VALIGN="top" | |
231 >SDL_GLattr</TD | |
232 ><TD | |
233 WIDTH="34%" | |
234 ALIGN="center" | |
235 VALIGN="top" | |
236 ><A | |
237 HREF="video.html" | |
238 >Up</A | |
239 ></TD | |
240 ><TD | |
241 WIDTH="33%" | |
242 ALIGN="right" | |
243 VALIGN="top" | |
244 >SDL_Color</TD | |
245 ></TR | |
246 ></TABLE | |
247 ></DIV | |
248 ></BODY | |
249 ></HTML | |
250 > |