Mercurial > sdl-ios-xcode
annotate docs/html/sdlquitevent.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_QuitEvent</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="SDL Event Structures." | |
14 HREF="eventstructures.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_UserEvent" | |
17 HREF="sdluserevent.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_keysym" | |
20 HREF="sdlkeysym.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="sdluserevent.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="sdlkeysym.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="SDLQUITEVENT" | |
71 >SDL_QuitEvent</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="AEN4237" |
0 | 77 ></A |
78 ><H2 | |
79 >Name</H2 | |
80 >SDL_QuitEvent -- Quit requested event</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="AEN4240" |
0 | 85 ></A |
86 ><H2 | |
87 >Structure Definition</H2 | |
88 ><PRE | |
89 CLASS="PROGRAMLISTING" | |
90 >typedef struct{ | |
91 Uint8 type | |
92 } SDL_QuitEvent;</PRE | |
93 ></DIV | |
94 ><DIV | |
95 CLASS="REFSECT1" | |
96 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
97 NAME="AEN4243" |
0 | 98 ></A |
99 ><H2 | |
100 >Structure Data</H2 | |
101 ><DIV | |
102 CLASS="INFORMALTABLE" | |
103 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
104 NAME="AEN4245" |
0 | 105 ></A |
106 ><P | |
107 ></P | |
108 ><TABLE | |
109 BORDER="0" | |
110 CLASS="CALSTABLE" | |
111 ><TBODY | |
112 ><TR | |
113 ><TD | |
114 ALIGN="LEFT" | |
115 VALIGN="TOP" | |
116 ><TT | |
117 CLASS="STRUCTFIELD" | |
118 ><I | |
119 >type</I | |
120 ></TT | |
121 ></TD | |
122 ><TD | |
123 ALIGN="LEFT" | |
124 VALIGN="TOP" | |
125 ><TT | |
126 CLASS="LITERAL" | |
127 >SDL_QUIT</TT | |
128 ></TD | |
129 ></TR | |
130 ></TBODY | |
131 ></TABLE | |
132 ><P | |
133 ></P | |
134 ></DIV | |
135 ></DIV | |
136 ><DIV | |
137 CLASS="REFSECT1" | |
138 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
139 NAME="AEN4253" |
0 | 140 ></A |
141 ><H2 | |
142 >Description</H2 | |
143 ><P | |
144 ><SPAN | |
145 CLASS="STRUCTNAME" | |
146 >SDL_QuitEvent</SPAN | |
147 > is a member of the <A | |
148 HREF="sdlevent.html" | |
149 ><SPAN | |
150 CLASS="STRUCTNAME" | |
151 >SDL_Event</SPAN | |
152 ></A | |
153 > union and is used whan an event of type <TT | |
154 CLASS="LITERAL" | |
155 >SDL_QUIT</TT | |
156 > is reported.</P | |
157 ><P | |
158 >As can be seen, the SDL_QuitEvent structure serves no useful purpose. The event itself, on the other hand, is very important. If you filter out or ignore a quit event then it is impossible for the user to close the window. On the other hand, if you do accept a quit event then the application window will be closed, and screen updates will still report success event though the application will no longer be visible.</P | |
159 ><DIV | |
160 CLASS="NOTE" | |
161 ><BLOCKQUOTE | |
162 CLASS="NOTE" | |
163 ><P | |
164 ><B | |
165 >Note: </B | |
166 >The macro <TT | |
167 CLASS="FUNCTION" | |
168 >SDL_QuitRequested</TT | |
169 > will return non-zero if a quit event is pending</P | |
170 ></BLOCKQUOTE | |
171 ></DIV | |
172 ></DIV | |
173 ><DIV | |
174 CLASS="REFSECT1" | |
175 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
176 NAME="AEN4264" |
0 | 177 ></A |
178 ><H2 | |
179 >See Also</H2 | |
180 ><P | |
181 ><A | |
182 HREF="sdlevent.html" | |
183 ><SPAN | |
184 CLASS="STRUCTNAME" | |
185 >SDL_Event</SPAN | |
186 ></A | |
187 >, | |
188 <A | |
189 HREF="sdlseteventfilter.html" | |
190 ><TT | |
191 CLASS="FUNCTION" | |
192 >SDL_SetEventFilter</TT | |
193 ></A | |
194 ></P | |
195 ></DIV | |
196 ><DIV | |
197 CLASS="NAVFOOTER" | |
198 ><HR | |
199 ALIGN="LEFT" | |
200 WIDTH="100%"><TABLE | |
201 WIDTH="100%" | |
202 BORDER="0" | |
203 CELLPADDING="0" | |
204 CELLSPACING="0" | |
205 ><TR | |
206 ><TD | |
207 WIDTH="33%" | |
208 ALIGN="left" | |
209 VALIGN="top" | |
210 ><A | |
211 HREF="sdluserevent.html" | |
212 >Prev</A | |
213 ></TD | |
214 ><TD | |
215 WIDTH="34%" | |
216 ALIGN="center" | |
217 VALIGN="top" | |
218 ><A | |
219 HREF="index.html" | |
220 >Home</A | |
221 ></TD | |
222 ><TD | |
223 WIDTH="33%" | |
224 ALIGN="right" | |
225 VALIGN="top" | |
226 ><A | |
227 HREF="sdlkeysym.html" | |
228 >Next</A | |
229 ></TD | |
230 ></TR | |
231 ><TR | |
232 ><TD | |
233 WIDTH="33%" | |
234 ALIGN="left" | |
235 VALIGN="top" | |
236 >SDL_UserEvent</TD | |
237 ><TD | |
238 WIDTH="34%" | |
239 ALIGN="center" | |
240 VALIGN="top" | |
241 ><A | |
242 HREF="eventstructures.html" | |
243 >Up</A | |
244 ></TD | |
245 ><TD | |
246 WIDTH="33%" | |
247 ALIGN="right" | |
248 VALIGN="top" | |
249 >SDL_keysym</TD | |
250 ></TR | |
251 ></TABLE | |
252 ></DIV | |
253 ></BODY | |
254 ></HTML | |
255 > |