Mercurial > sdl-ios-xcode
annotate docs/html/general.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 >General</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 Reference" | |
14 HREF="reference.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL Reference" | |
17 HREF="reference.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_Init" | |
20 HREF="sdlinit.html"><META | |
21 NAME="KEYWORD" | |
22 CONTENT="general"><META | |
23 NAME="KEYWORD" | |
24 CONTENT="function"></HEAD | |
25 ><BODY | |
26 CLASS="CHAPTER" | |
27 BGCOLOR="#FFF8DC" | |
28 TEXT="#000000" | |
29 LINK="#0000ee" | |
30 VLINK="#551a8b" | |
31 ALINK="#ff0000" | |
32 ><DIV | |
33 CLASS="NAVHEADER" | |
34 ><TABLE | |
35 WIDTH="100%" | |
36 BORDER="0" | |
37 CELLPADDING="0" | |
38 CELLSPACING="0" | |
39 ><TR | |
40 ><TH | |
41 COLSPAN="3" | |
42 ALIGN="center" | |
43 >SDL Library Documentation</TH | |
44 ></TR | |
45 ><TR | |
46 ><TD | |
47 WIDTH="10%" | |
48 ALIGN="left" | |
49 VALIGN="bottom" | |
50 ><A | |
51 HREF="reference.html" | |
52 >Prev</A | |
53 ></TD | |
54 ><TD | |
55 WIDTH="80%" | |
56 ALIGN="center" | |
57 VALIGN="bottom" | |
58 ></TD | |
59 ><TD | |
60 WIDTH="10%" | |
61 ALIGN="right" | |
62 VALIGN="bottom" | |
63 ><A | |
64 HREF="sdlinit.html" | |
65 >Next</A | |
66 ></TD | |
67 ></TR | |
68 ></TABLE | |
69 ><HR | |
70 ALIGN="LEFT" | |
71 WIDTH="100%"></DIV | |
72 ><DIV | |
73 CLASS="CHAPTER" | |
74 ><H1 | |
75 ><A | |
76 NAME="GENERAL" | |
77 >Chapter 5. General</A | |
78 ></H1 | |
79 ><DIV | |
80 CLASS="TOC" | |
81 ><DL | |
82 ><DT | |
83 ><B | |
84 >Table of Contents</B | |
85 ></DT | |
86 ><DT | |
87 ><A | |
88 HREF="sdlinit.html" | |
89 >SDL_Init</A | |
90 > — Initializes SDL</DT | |
91 ><DT | |
92 ><A | |
93 HREF="sdlinitsubsystem.html" | |
94 >SDL_InitSubSystem</A | |
95 > — Initialize subsystems</DT | |
96 ><DT | |
97 ><A | |
98 HREF="sdlquitsubsystem.html" | |
99 >SDL_QuitSubSystem</A | |
100 > — Shut down a subsystem</DT | |
101 ><DT | |
102 ><A | |
103 HREF="sdlquit.html" | |
104 >SDL_Quit</A | |
105 > — Shut down SDL</DT | |
106 ><DT | |
107 ><A | |
108 HREF="sdlwasinit.html" | |
109 >SDL_WasInit</A | |
110 > — Check which subsystems are initialized</DT | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
111 ><DT |
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
112 ><A |
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
113 HREF="sdlgeterror.html" |
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
114 >SDL_GetError</A |
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
115 > — Get SDL error string</DT |
0 | 116 ></DL |
117 ></DIV | |
118 ><P | |
119 >Before SDL can be used in a program it must be initialized with <A | |
120 HREF="sdlinit.html" | |
121 ><TT | |
122 CLASS="FUNCTION" | |
123 >SDL_Init</TT | |
124 ></A | |
125 >. <TT | |
126 CLASS="FUNCTION" | |
127 >SDL_Init</TT | |
128 > initializes all the subsystems that the user requests (video, audio, joystick, timers and/or cdrom). Once SDL is initialized with <TT | |
129 CLASS="FUNCTION" | |
130 >SDL_Init</TT | |
131 > subsystems can be shut down and initialized as needed using <A | |
132 HREF="sdlinitsubsystem.html" | |
133 ><TT | |
134 CLASS="FUNCTION" | |
135 >SDL_InitSubSystem</TT | |
136 ></A | |
137 > and <A | |
138 HREF="sdlquitsubsystem.html" | |
139 ><TT | |
140 CLASS="FUNCTION" | |
141 >SDL_QuitSubSystem</TT | |
142 ></A | |
143 >.</P | |
144 ><P | |
145 >SDL must also be shut down before the program exits to make sure it cleans up correctly. Calling <A | |
146 HREF="sdlquit.html" | |
147 ><TT | |
148 CLASS="FUNCTION" | |
149 >SDL_Quit</TT | |
150 ></A | |
151 > shuts down all subsystems and frees any resources allocated to SDL.</P | |
152 ></DIV | |
153 ><DIV | |
154 CLASS="NAVFOOTER" | |
155 ><HR | |
156 ALIGN="LEFT" | |
157 WIDTH="100%"><TABLE | |
158 WIDTH="100%" | |
159 BORDER="0" | |
160 CELLPADDING="0" | |
161 CELLSPACING="0" | |
162 ><TR | |
163 ><TD | |
164 WIDTH="33%" | |
165 ALIGN="left" | |
166 VALIGN="top" | |
167 ><A | |
168 HREF="reference.html" | |
169 >Prev</A | |
170 ></TD | |
171 ><TD | |
172 WIDTH="34%" | |
173 ALIGN="center" | |
174 VALIGN="top" | |
175 ><A | |
176 HREF="index.html" | |
177 >Home</A | |
178 ></TD | |
179 ><TD | |
180 WIDTH="33%" | |
181 ALIGN="right" | |
182 VALIGN="top" | |
183 ><A | |
184 HREF="sdlinit.html" | |
185 >Next</A | |
186 ></TD | |
187 ></TR | |
188 ><TR | |
189 ><TD | |
190 WIDTH="33%" | |
191 ALIGN="left" | |
192 VALIGN="top" | |
193 >SDL Reference</TD | |
194 ><TD | |
195 WIDTH="34%" | |
196 ALIGN="center" | |
197 VALIGN="top" | |
198 ><A | |
199 HREF="reference.html" | |
200 >Up</A | |
201 ></TD | |
202 ><TD | |
203 WIDTH="33%" | |
204 ALIGN="right" | |
205 VALIGN="top" | |
206 >SDL_Init</TD | |
207 ></TR | |
208 ></TABLE | |
209 ></DIV | |
210 ></BODY | |
211 ></HTML | |
212 > |