Mercurial > sdl-ios-xcode
annotate docs/html/guideexamples.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 | 55f1f1b3e27d |
children | 355632dca928 |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >Examples</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 Guide" | |
14 HREF="guide.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="Handling the Keyboard" | |
17 HREF="guideinputkeyboard.html"><LINK | |
18 REL="NEXT" | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
19 TITLE="Event Examples" |
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
20 HREF="guideeventexamples.html"></HEAD |
0 | 21 ><BODY |
22 CLASS="CHAPTER" | |
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="guideinputkeyboard.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 | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
60 HREF="guideeventexamples.html" |
0 | 61 >Next</A |
62 ></TD | |
63 ></TR | |
64 ></TABLE | |
65 ><HR | |
66 ALIGN="LEFT" | |
67 WIDTH="100%"></DIV | |
68 ><DIV | |
69 CLASS="CHAPTER" | |
70 ><H1 | |
71 ><A | |
72 NAME="GUIDEEXAMPLES" | |
73 >Chapter 4. Examples</A | |
74 ></H1 | |
75 ><DIV | |
76 CLASS="TOC" | |
77 ><DL | |
78 ><DT | |
79 ><B | |
80 >Table of Contents</B | |
81 ></DT | |
82 ><DT | |
83 ><A | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
84 HREF="guideexamples.html#AEN369" |
0 | 85 >Introduction</A |
86 ></DT | |
87 ><DT | |
88 ><A | |
89 HREF="guideeventexamples.html" | |
90 >Event Examples</A | |
91 ></DT | |
92 ><DT | |
93 ><A | |
94 HREF="guideaudioexamples.html" | |
95 >Audio Examples</A | |
96 ></DT | |
97 ><DT | |
98 ><A | |
99 HREF="guidecdromexamples.html" | |
100 >CDROM Examples</A | |
101 ></DT | |
102 ><DT | |
103 ><A | |
104 HREF="guidetimeexamples.html" | |
105 >Time Examples</A | |
106 ></DT | |
107 ></DL | |
108 ></DIV | |
109 ><DIV | |
110 CLASS="SECT1" | |
111 ><H1 | |
112 CLASS="SECT1" | |
113 ><A | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
114 NAME="AEN369" |
0 | 115 >Introduction</A |
116 ></H1 | |
117 ><P | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
118 >For the moment these examples are taken directly from the old SDL documentation. By the 1.2 release these examples should hopefully deal with most common SDL programming problems.</P |
0 | 119 ></DIV |
120 ></DIV | |
121 ><DIV | |
122 CLASS="NAVFOOTER" | |
123 ><HR | |
124 ALIGN="LEFT" | |
125 WIDTH="100%"><TABLE | |
126 WIDTH="100%" | |
127 BORDER="0" | |
128 CELLPADDING="0" | |
129 CELLSPACING="0" | |
130 ><TR | |
131 ><TD | |
132 WIDTH="33%" | |
133 ALIGN="left" | |
134 VALIGN="top" | |
135 ><A | |
136 HREF="guideinputkeyboard.html" | |
137 >Prev</A | |
138 ></TD | |
139 ><TD | |
140 WIDTH="34%" | |
141 ALIGN="center" | |
142 VALIGN="top" | |
143 ><A | |
144 HREF="index.html" | |
145 >Home</A | |
146 ></TD | |
147 ><TD | |
148 WIDTH="33%" | |
149 ALIGN="right" | |
150 VALIGN="top" | |
151 ><A | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
152 HREF="guideeventexamples.html" |
0 | 153 >Next</A |
154 ></TD | |
155 ></TR | |
156 ><TR | |
157 ><TD | |
158 WIDTH="33%" | |
159 ALIGN="left" | |
160 VALIGN="top" | |
161 >Handling the Keyboard</TD | |
162 ><TD | |
163 WIDTH="34%" | |
164 ALIGN="center" | |
165 VALIGN="top" | |
166 ><A | |
167 HREF="guide.html" | |
168 >Up</A | |
169 ></TD | |
170 ><TD | |
171 WIDTH="33%" | |
172 ALIGN="right" | |
173 VALIGN="top" | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
174 >Event Examples</TD |
0 | 175 ></TR |
176 ></TABLE | |
177 ></DIV | |
178 ></BODY | |
179 ></HTML | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
180 > |