Mercurial > sdl-ios-xcode
annotate docs/html/time.html @ 968:4675910b0b7b
Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
From: Hannu Savolainen
Subject: Re: SDL uses obsolete OSS features
I did some work on getting OSS to work better with SDL. There have been
some problems with select which should be fixed now.
I'm having some problems in understanding what is the purpose of the
DSP_WaitAudio() routine. I added a return to the very beginning of this
routine and commendted out the define for USE_BLOCKING_WRITES. At least
lbreakout2 seems to work as well as earlier. The latencies are the same.
An ordinary blocking write does exactly the same thing than DSP_WaitAudio
does. So I would recommend using the USE_BLOCKING_WRITES approach and
removing everything from the DSP_WaitAudio routine. Also enabling
USE_BLOCKING_WRITES makes it possible to simplify DSP_PlayAudio() because
you don't need to handle the partial writes (the do-while loop).
Attached is a patch against SDL-1.2.7. After these changes SDL will use
OSS as it's designed to be used (make it as simple as possible). This code
should work with all OSS implementations because it uses only the very
fundamental features that have been there since the jurassic times.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 12 Nov 2004 21:39:04 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >Time</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ |
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_CondWaitTimeout" | |
17 HREF="sdlcondwaittimeout.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_GetTicks" | |
20 HREF="sdlgetticks.html"><META | |
21 NAME="KEYWORD" | |
22 CONTENT="time"><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 | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
35 SUMMARY="Header navigation table" |
0 | 36 WIDTH="100%" |
37 BORDER="0" | |
38 CELLPADDING="0" | |
39 CELLSPACING="0" | |
40 ><TR | |
41 ><TH | |
42 COLSPAN="3" | |
43 ALIGN="center" | |
44 >SDL Library Documentation</TH | |
45 ></TR | |
46 ><TR | |
47 ><TD | |
48 WIDTH="10%" | |
49 ALIGN="left" | |
50 VALIGN="bottom" | |
51 ><A | |
52 HREF="sdlcondwaittimeout.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
53 ACCESSKEY="P" |
0 | 54 >Prev</A |
55 ></TD | |
56 ><TD | |
57 WIDTH="80%" | |
58 ALIGN="center" | |
59 VALIGN="bottom" | |
60 ></TD | |
61 ><TD | |
62 WIDTH="10%" | |
63 ALIGN="right" | |
64 VALIGN="bottom" | |
65 ><A | |
66 HREF="sdlgetticks.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
67 ACCESSKEY="N" |
0 | 68 >Next</A |
69 ></TD | |
70 ></TR | |
71 ></TABLE | |
72 ><HR | |
73 ALIGN="LEFT" | |
74 WIDTH="100%"></DIV | |
75 ><DIV | |
76 CLASS="CHAPTER" | |
77 ><H1 | |
78 ><A | |
79 NAME="TIME" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
80 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
81 >Chapter 13. Time</H1 |
0 | 82 ><DIV |
83 CLASS="TOC" | |
84 ><DL | |
85 ><DT | |
86 ><B | |
87 >Table of Contents</B | |
88 ></DT | |
89 ><DT | |
90 ><A | |
91 HREF="sdlgetticks.html" | |
92 >SDL_GetTicks</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
93 > -- Get the number of milliseconds since the SDL library initialization.</DT |
0 | 94 ><DT |
95 ><A | |
96 HREF="sdldelay.html" | |
97 >SDL_Delay</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
98 > -- Wait a specified number of milliseconds before returning.</DT |
0 | 99 ><DT |
100 ><A | |
101 HREF="sdladdtimer.html" | |
102 >SDL_AddTimer</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
103 > -- Add a timer which will call a callback after the specified number of milliseconds has |
0 | 104 elapsed.</DT |
105 ><DT | |
106 ><A | |
107 HREF="sdlremovetimer.html" | |
108 >SDL_RemoveTimer</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
109 > -- Remove a timer which was added with |
0 | 110 <A |
111 HREF="sdladdtimer.html" | |
112 >SDL_AddTimer</A | |
113 >.</DT | |
114 ><DT | |
115 ><A | |
116 HREF="sdlsettimer.html" | |
117 >SDL_SetTimer</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
118 > -- Set a callback to run after the specified number of milliseconds has |
0 | 119 elapsed.</DT |
120 ></DL | |
121 ></DIV | |
122 ><P | |
123 >SDL provides several cross-platform functions for dealing with time. | |
124 It provides a way to get the current time, a way to wait a little while, | |
125 and a simple timer mechanism. These functions give you two ways of moving an | |
126 object every x milliseconds: | |
127 | |
128 <P | |
129 ></P | |
130 ><UL | |
131 ><LI | |
132 ><P | |
133 >Use a timer callback function. This may have the bad effect that it runs in a seperate thread or uses alarm signals, but it's easier to implement.</P | |
134 ></LI | |
135 ><LI | |
136 ><P | |
137 >Or you can get the number of milliseconds passed, and move the object if, for example, 30 ms passed.</P | |
138 ></LI | |
139 ></UL | |
140 > </P | |
141 ></DIV | |
142 ><DIV | |
143 CLASS="NAVFOOTER" | |
144 ><HR | |
145 ALIGN="LEFT" | |
146 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
147 SUMMARY="Footer navigation table" |
0 | 148 WIDTH="100%" |
149 BORDER="0" | |
150 CELLPADDING="0" | |
151 CELLSPACING="0" | |
152 ><TR | |
153 ><TD | |
154 WIDTH="33%" | |
155 ALIGN="left" | |
156 VALIGN="top" | |
157 ><A | |
158 HREF="sdlcondwaittimeout.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
159 ACCESSKEY="P" |
0 | 160 >Prev</A |
161 ></TD | |
162 ><TD | |
163 WIDTH="34%" | |
164 ALIGN="center" | |
165 VALIGN="top" | |
166 ><A | |
167 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
168 ACCESSKEY="H" |
0 | 169 >Home</A |
170 ></TD | |
171 ><TD | |
172 WIDTH="33%" | |
173 ALIGN="right" | |
174 VALIGN="top" | |
175 ><A | |
176 HREF="sdlgetticks.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
177 ACCESSKEY="N" |
0 | 178 >Next</A |
179 ></TD | |
180 ></TR | |
181 ><TR | |
182 ><TD | |
183 WIDTH="33%" | |
184 ALIGN="left" | |
185 VALIGN="top" | |
186 >SDL_CondWaitTimeout</TD | |
187 ><TD | |
188 WIDTH="34%" | |
189 ALIGN="center" | |
190 VALIGN="top" | |
191 ><A | |
192 HREF="reference.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
193 ACCESSKEY="U" |
0 | 194 >Up</A |
195 ></TD | |
196 ><TD | |
197 WIDTH="33%" | |
198 ALIGN="right" | |
199 VALIGN="top" | |
200 >SDL_GetTicks</TD | |
201 ></TR | |
202 ></TABLE | |
203 ></DIV | |
204 ></BODY | |
205 ></HTML | |
206 > |