Mercurial > sdl-ios-xcode
annotate docs/html/sdlcolor.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_Color</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_Rect" | |
17 HREF="sdlrect.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_Palette" | |
20 HREF="sdlpalette.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="sdlrect.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="sdlpalette.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="SDLCOLOR" | |
71 >SDL_Color</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="AEN2698" |
0 | 77 ></A |
78 ><H2 | |
79 >Name</H2 | |
80 >SDL_Color -- Format independent color description</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="AEN2701" |
0 | 85 ></A |
86 ><H2 | |
87 >Structure Definition</H2 | |
88 ><PRE | |
89 CLASS="PROGRAMLISTING" | |
90 >typedef struct{ | |
91 Uint8 r; | |
92 Uint8 g; | |
93 Uint8 b; | |
94 Uint8 unused; | |
95 } SDL_Color;</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="AEN2704" |
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="AEN2706" |
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 >r</I | |
123 ></TT | |
124 ></TD | |
125 ><TD | |
126 ALIGN="LEFT" | |
127 VALIGN="TOP" | |
128 >Red intensity</TD | |
129 ></TR | |
130 ><TR | |
131 ><TD | |
132 ALIGN="LEFT" | |
133 VALIGN="TOP" | |
134 ><TT | |
135 CLASS="STRUCTFIELD" | |
136 ><I | |
137 >g</I | |
138 ></TT | |
139 ></TD | |
140 ><TD | |
141 ALIGN="LEFT" | |
142 VALIGN="TOP" | |
143 >Green intensity</TD | |
144 ></TR | |
145 ><TR | |
146 ><TD | |
147 ALIGN="LEFT" | |
148 VALIGN="TOP" | |
149 ><TT | |
150 CLASS="STRUCTFIELD" | |
151 ><I | |
152 >b</I | |
153 ></TT | |
154 ></TD | |
155 ><TD | |
156 ALIGN="LEFT" | |
157 VALIGN="TOP" | |
158 >Blue intensity</TD | |
159 ></TR | |
160 ><TR | |
161 ><TD | |
162 ALIGN="LEFT" | |
163 VALIGN="TOP" | |
164 ><TT | |
165 CLASS="STRUCTFIELD" | |
166 ><I | |
167 >unused</I | |
168 ></TT | |
169 ></TD | |
170 ><TD | |
171 ALIGN="LEFT" | |
172 VALIGN="TOP" | |
173 >Unused</TD | |
174 ></TR | |
175 ></TBODY | |
176 ></TABLE | |
177 ><P | |
178 ></P | |
179 ></DIV | |
180 ></DIV | |
181 ><DIV | |
182 CLASS="REFSECT1" | |
183 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
184 NAME="AEN2725" |
0 | 185 ></A |
186 ><H2 | |
187 >Description</H2 | |
188 ><P | |
189 ><SPAN | |
190 CLASS="STRUCTNAME" | |
191 >SDL_Color</SPAN | |
192 > describes a color in a format independent way. You can convert a <SPAN | |
193 CLASS="STRUCTNAME" | |
194 >SDL_Color</SPAN | |
195 > to a pixel value for a certain pixel format using <A | |
196 HREF="sdlmaprgb.html" | |
197 ><TT | |
198 CLASS="FUNCTION" | |
199 >SDL_MapRGB</TT | |
200 ></A | |
201 >.</P | |
202 ></DIV | |
203 ><DIV | |
204 CLASS="REFSECT1" | |
205 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
206 NAME="AEN2732" |
0 | 207 ></A |
208 ><H2 | |
209 >See Also</H2 | |
210 ><P | |
211 ><A | |
212 HREF="sdlpixelformat.html" | |
213 ><SPAN | |
214 CLASS="STRUCTNAME" | |
215 >SDL_PixelFormat</SPAN | |
216 ></A | |
217 >, | |
218 <A | |
219 HREF="sdlsetcolors.html" | |
220 ><TT | |
221 CLASS="FUNCTION" | |
222 >SDL_SetColors</TT | |
223 ></A | |
224 >, | |
225 <A | |
226 HREF="sdlpalette.html" | |
227 ><TT | |
228 CLASS="FUNCTION" | |
229 >SDL_Palette</TT | |
230 ></A | |
231 ></P | |
232 ></DIV | |
233 ><DIV | |
234 CLASS="NAVFOOTER" | |
235 ><HR | |
236 ALIGN="LEFT" | |
237 WIDTH="100%"><TABLE | |
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="sdlrect.html" | |
249 >Prev</A | |
250 ></TD | |
251 ><TD | |
252 WIDTH="34%" | |
253 ALIGN="center" | |
254 VALIGN="top" | |
255 ><A | |
256 HREF="index.html" | |
257 >Home</A | |
258 ></TD | |
259 ><TD | |
260 WIDTH="33%" | |
261 ALIGN="right" | |
262 VALIGN="top" | |
263 ><A | |
264 HREF="sdlpalette.html" | |
265 >Next</A | |
266 ></TD | |
267 ></TR | |
268 ><TR | |
269 ><TD | |
270 WIDTH="33%" | |
271 ALIGN="left" | |
272 VALIGN="top" | |
273 >SDL_Rect</TD | |
274 ><TD | |
275 WIDTH="34%" | |
276 ALIGN="center" | |
277 VALIGN="top" | |
278 ><A | |
279 HREF="video.html" | |
280 >Up</A | |
281 ></TD | |
282 ><TD | |
283 WIDTH="33%" | |
284 ALIGN="right" | |
285 VALIGN="top" | |
286 >SDL_Palette</TD | |
287 ></TR | |
288 ></TABLE | |
289 ></DIV | |
290 ></BODY | |
291 ></HTML | |
292 > |