Mercurial > sdl-ios-xcode
annotate docs/html/guidethebasics.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 >The Basics</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="Credits" | |
17 HREF="guidecredits.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="Initializing SDL" | |
20 HREF="guidebasicsinit.html"></HEAD | |
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="guidecredits.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="guidebasicsinit.html" | |
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="GUIDETHEBASICS" | |
73 >Chapter 1. The Basics</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 | |
84 HREF="guidethebasics.html#GUIDEINTRODUCTION" | |
85 >Introduction</A | |
86 ></DT | |
87 ><DT | |
88 ><A | |
89 HREF="guidebasicsinit.html" | |
90 >Initializing SDL</A | |
91 ></DT | |
92 ></DL | |
93 ></DIV | |
94 ><DIV | |
95 CLASS="SECT1" | |
96 ><H1 | |
97 CLASS="SECT1" | |
98 ><A | |
99 NAME="GUIDEINTRODUCTION" | |
100 >Introduction</A | |
101 ></H1 | |
102 ><P | |
103 >The SDL Guide section is pretty incomplete. If you feel you have anything to add mail akawaka@skynet.ie or visit http://akawaka.csn.ul.ie/tne/.</P | |
104 ></DIV | |
105 ></DIV | |
106 ><DIV | |
107 CLASS="NAVFOOTER" | |
108 ><HR | |
109 ALIGN="LEFT" | |
110 WIDTH="100%"><TABLE | |
111 WIDTH="100%" | |
112 BORDER="0" | |
113 CELLPADDING="0" | |
114 CELLSPACING="0" | |
115 ><TR | |
116 ><TD | |
117 WIDTH="33%" | |
118 ALIGN="left" | |
119 VALIGN="top" | |
120 ><A | |
121 HREF="guidecredits.html" | |
122 >Prev</A | |
123 ></TD | |
124 ><TD | |
125 WIDTH="34%" | |
126 ALIGN="center" | |
127 VALIGN="top" | |
128 ><A | |
129 HREF="index.html" | |
130 >Home</A | |
131 ></TD | |
132 ><TD | |
133 WIDTH="33%" | |
134 ALIGN="right" | |
135 VALIGN="top" | |
136 ><A | |
137 HREF="guidebasicsinit.html" | |
138 >Next</A | |
139 ></TD | |
140 ></TR | |
141 ><TR | |
142 ><TD | |
143 WIDTH="33%" | |
144 ALIGN="left" | |
145 VALIGN="top" | |
146 >Credits</TD | |
147 ><TD | |
148 WIDTH="34%" | |
149 ALIGN="center" | |
150 VALIGN="top" | |
151 ><A | |
152 HREF="guide.html" | |
153 >Up</A | |
154 ></TD | |
155 ><TD | |
156 WIDTH="33%" | |
157 ALIGN="right" | |
158 VALIGN="top" | |
159 >Initializing SDL</TD | |
160 ></TR | |
161 ></TABLE | |
162 ></DIV | |
163 ></BODY | |
164 ></HTML | |
165 > |