Mercurial > sdl-ios-xcode
annotate docs/html/event.html @ 765:4c2ba6161939
Editors Note: The original patch was modified to use SDL_Delay() instead of
nanosleep because nanosleep may not be portable to all systems
using SDL with the ALSA backend. This may be a moot point with
the switch to blocking writes anyway...
Date: Sat, 27 Dec 2003 21:47:36 +0100
From: Michel Daenzer
To: Debian Bug Tracking System
Subject: [SDL] Bug#225252: [PATCH] ALSA fixes
Package: libsdl1.2debian-all
Version: 1.2.6-2
Severity: normal
Tags: patch
For SDL 1.2.6, the ALSA backend was changed to call snd_pcm_open() with
SND_PCM_NONBLOCK. That's a good idea per se, however, it causes high CPU
usage, interrupted sound and stuttering in some games here. Taking a nanosleep
whenever snd_pcm_writei() returns -EAGAIN fixes this, but I think it's more
efficient to use blocking mode for the actual sound playback. Feedback from the
SDL and ALSA lists appreciated.
The patch also fixes the default ALSA device to be used.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 04 Jan 2004 15:40:50 +0000 |
parents | e5bc29de3f0a |
children | 355632dca928 |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >Events</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_WM_GrabInput" | |
17 HREF="sdlwmgrabinput.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL Event Structures." | |
20 HREF="eventstructures.html"><META | |
21 NAME="KEYWORD" | |
22 CONTENT="events"><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="sdlwmgrabinput.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="eventstructures.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="EVENT" | |
77 >Chapter 8. Events</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 | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
88 HREF="event.html#AEN3307" |
0 | 89 >Introduction</A |
90 ></DT | |
91 ><DT | |
92 ><A | |
93 HREF="eventstructures.html" | |
94 >SDL Event Structures.</A | |
95 ></DT | |
96 ><DT | |
97 ><A | |
98 HREF="eventfunctions.html" | |
99 >Event Functions.</A | |
100 ></DT | |
101 ></DL | |
102 ></DIV | |
103 ><DIV | |
104 CLASS="SECT1" | |
105 ><H1 | |
106 CLASS="SECT1" | |
107 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
108 NAME="AEN3307" |
0 | 109 >Introduction</A |
110 ></H1 | |
111 ><P | |
112 >Event handling allows your application to receive input from the user. Event handling is initalised (along with video) with a call to: | |
113 <PRE | |
114 CLASS="PROGRAMLISTING" | |
115 >SDL_Init(SDL_INIT_VIDEO);</PRE | |
116 > | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
117 Internally, SDL stores all the events waiting to be handled in an event queue. Using functions like <A |
0 | 118 HREF="sdlpollevent.html" |
119 ><TT | |
120 CLASS="FUNCTION" | |
121 >SDL_PollEvent</TT | |
122 ></A | |
123 > and <A | |
124 HREF="sdlpeepevents.html" | |
125 ><TT | |
126 CLASS="FUNCTION" | |
127 >SDL_PeepEvents</TT | |
128 ></A | |
129 > you can observe and handle waiting input events.</P | |
130 ><P | |
131 >The key to event handling in SDL is the <A | |
132 HREF="sdlevent.html" | |
133 ><SPAN | |
134 CLASS="STRUCTNAME" | |
135 >SDL_Event</SPAN | |
136 ></A | |
137 > union. The event queue itself is composed of a series of <SPAN | |
138 CLASS="STRUCTNAME" | |
139 >SDL_Event</SPAN | |
140 > unions, one for each waiting event. <SPAN | |
141 CLASS="STRUCTNAME" | |
142 >SDL_Event</SPAN | |
143 > unions are read from the queue with the <TT | |
144 CLASS="FUNCTION" | |
145 >SDL_PollEvent</TT | |
146 > function and it is then up to the application to process the information stored with them.</P | |
147 ></DIV | |
148 ></DIV | |
149 ><DIV | |
150 CLASS="NAVFOOTER" | |
151 ><HR | |
152 ALIGN="LEFT" | |
153 WIDTH="100%"><TABLE | |
154 WIDTH="100%" | |
155 BORDER="0" | |
156 CELLPADDING="0" | |
157 CELLSPACING="0" | |
158 ><TR | |
159 ><TD | |
160 WIDTH="33%" | |
161 ALIGN="left" | |
162 VALIGN="top" | |
163 ><A | |
164 HREF="sdlwmgrabinput.html" | |
165 >Prev</A | |
166 ></TD | |
167 ><TD | |
168 WIDTH="34%" | |
169 ALIGN="center" | |
170 VALIGN="top" | |
171 ><A | |
172 HREF="index.html" | |
173 >Home</A | |
174 ></TD | |
175 ><TD | |
176 WIDTH="33%" | |
177 ALIGN="right" | |
178 VALIGN="top" | |
179 ><A | |
180 HREF="eventstructures.html" | |
181 >Next</A | |
182 ></TD | |
183 ></TR | |
184 ><TR | |
185 ><TD | |
186 WIDTH="33%" | |
187 ALIGN="left" | |
188 VALIGN="top" | |
189 >SDL_WM_GrabInput</TD | |
190 ><TD | |
191 WIDTH="34%" | |
192 ALIGN="center" | |
193 VALIGN="top" | |
194 ><A | |
195 HREF="reference.html" | |
196 >Up</A | |
197 ></TD | |
198 ><TD | |
199 WIDTH="33%" | |
200 ALIGN="right" | |
201 VALIGN="top" | |
202 >SDL Event Structures.</TD | |
203 ></TR | |
204 ></TABLE | |
205 ></DIV | |
206 ></BODY | |
207 ></HTML | |
208 > |