Mercurial > sdl-ios-xcode
annotate docs/html/sdljoyhatevent.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 >SDL_JoyHatEvent</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 Event Structures." | |
14 HREF="eventstructures.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_JoyButtonEvent" | |
17 HREF="sdljoybuttonevent.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_JoyBallEvent" | |
20 HREF="sdljoyballevent.html"></HEAD | |
21 ><BODY | |
22 CLASS="REFENTRY" | |
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="sdljoybuttonevent.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="sdljoyballevent.html" | |
61 >Next</A | |
62 ></TD | |
63 ></TR | |
64 ></TABLE | |
65 ><HR | |
66 ALIGN="LEFT" | |
67 WIDTH="100%"></DIV | |
68 ><H1 | |
69 ><A | |
70 NAME="SDLJOYHATEVENT" | |
71 >SDL_JoyHatEvent</A | |
72 ></H1 | |
73 ><DIV | |
74 CLASS="REFNAMEDIV" | |
75 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
76 NAME="AEN3936" |
0 | 77 ></A |
78 ><H2 | |
79 >Name</H2 | |
80 >SDL_JoyHatEvent -- Joystick hat position change event structure</DIV | |
81 ><DIV | |
82 CLASS="REFSECT1" | |
83 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
84 NAME="AEN3939" |
0 | 85 ></A |
86 ><H2 | |
87 >Structure Definition</H2 | |
88 ><PRE | |
89 CLASS="PROGRAMLISTING" | |
90 >typedef struct{ | |
91 Uint8 type; | |
92 Uint8 which; | |
93 Uint8 hat; | |
94 Uint8 value; | |
95 } SDL_JoyHatEvent;</PRE | |
96 ></DIV | |
97 ><DIV | |
98 CLASS="REFSECT1" | |
99 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
100 NAME="AEN3942" |
0 | 101 ></A |
102 ><H2 | |
103 >Structure Data</H2 | |
104 ><DIV | |
105 CLASS="INFORMALTABLE" | |
106 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
107 NAME="AEN3944" |
0 | 108 ></A |
109 ><P | |
110 ></P | |
111 ><TABLE | |
112 BORDER="0" | |
113 CLASS="CALSTABLE" | |
114 ><TBODY | |
115 ><TR | |
116 ><TD | |
117 ALIGN="LEFT" | |
118 VALIGN="TOP" | |
119 ><TT | |
120 CLASS="STRUCTFIELD" | |
121 ><I | |
122 >type</I | |
123 ></TT | |
124 ></TD | |
125 ><TD | |
126 ALIGN="LEFT" | |
127 VALIGN="TOP" | |
128 ><TT | |
129 CLASS="LITERAL" | |
130 >SDL_JOY</TT | |
131 ></TD | |
132 ></TR | |
133 ><TR | |
134 ><TD | |
135 ALIGN="LEFT" | |
136 VALIGN="TOP" | |
137 ><TT | |
138 CLASS="STRUCTFIELD" | |
139 ><I | |
140 >which</I | |
141 ></TT | |
142 ></TD | |
143 ><TD | |
144 ALIGN="LEFT" | |
145 VALIGN="TOP" | |
146 >Joystick device index</TD | |
147 ></TR | |
148 ><TR | |
149 ><TD | |
150 ALIGN="LEFT" | |
151 VALIGN="TOP" | |
152 ><TT | |
153 CLASS="STRUCTFIELD" | |
154 ><I | |
155 >hat</I | |
156 ></TT | |
157 ></TD | |
158 ><TD | |
159 ALIGN="LEFT" | |
160 VALIGN="TOP" | |
161 >Joystick hat index</TD | |
162 ></TR | |
163 ><TR | |
164 ><TD | |
165 ALIGN="LEFT" | |
166 VALIGN="TOP" | |
167 ><TT | |
168 CLASS="STRUCTFIELD" | |
169 ><I | |
170 >value</I | |
171 ></TT | |
172 ></TD | |
173 ><TD | |
174 ALIGN="LEFT" | |
175 VALIGN="TOP" | |
176 >Hat position</TD | |
177 ></TR | |
178 ></TBODY | |
179 ></TABLE | |
180 ><P | |
181 ></P | |
182 ></DIV | |
183 ></DIV | |
184 ><DIV | |
185 CLASS="REFSECT1" | |
186 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
187 NAME="AEN3964" |
0 | 188 ></A |
189 ><H2 | |
190 >Description</H2 | |
191 ><P | |
192 ><SPAN | |
193 CLASS="STRUCTNAME" | |
194 >SDL_JoyHatEvent</SPAN | |
195 > is a member of the <A | |
196 HREF="sdlevent.html" | |
197 ><SPAN | |
198 CLASS="STRUCTNAME" | |
199 >SDL_Event</SPAN | |
200 ></A | |
201 > union and is used when an event of type <TT | |
202 CLASS="LITERAL" | |
203 >SDL_JOYHATMOTION</TT | |
204 > is reported.</P | |
205 ><P | |
206 >A <TT | |
207 CLASS="LITERAL" | |
208 >SDL_JOYHATMOTION</TT | |
209 > event occurs when ever a user moves a hat on the joystick. The field <TT | |
210 CLASS="STRUCTFIELD" | |
211 ><I | |
212 >which</I | |
213 ></TT | |
214 > is the index of the joystick that reported the event and <TT | |
215 CLASS="STRUCTFIELD" | |
216 ><I | |
217 >hat</I | |
218 ></TT | |
219 > is the index of the hat (for a more detailed exlaination see the <A | |
220 HREF="joystick.html" | |
221 >Joystick section</A | |
222 >). <TT | |
223 CLASS="STRUCTFIELD" | |
224 ><I | |
225 >value</I | |
226 ></TT | |
227 > is the current position of the hat. It is a logically OR'd combination of the following values (whose meanings should be pretty obvious:) :</P | |
228 ><P | |
229 ></P | |
230 ><TABLE | |
231 BORDER="0" | |
232 ><TBODY | |
233 ><TR | |
234 ><TD | |
235 ><TT | |
236 CLASS="LITERAL" | |
237 >SDL_HAT_CENTERED</TT | |
238 ></TD | |
239 ></TR | |
240 ><TR | |
241 ><TD | |
242 ><TT | |
243 CLASS="LITERAL" | |
244 >SDL_HAT_UP</TT | |
245 ></TD | |
246 ></TR | |
247 ><TR | |
248 ><TD | |
249 ><TT | |
250 CLASS="LITERAL" | |
251 >SDL_HAT_RIGHT</TT | |
252 ></TD | |
253 ></TR | |
254 ><TR | |
255 ><TD | |
256 ><TT | |
257 CLASS="LITERAL" | |
258 >SDL_HAT_DOWN</TT | |
259 ></TD | |
260 ></TR | |
261 ><TR | |
262 ><TD | |
263 ><TT | |
264 CLASS="LITERAL" | |
265 >SDL_HAT_LEFT</TT | |
266 ></TD | |
267 ></TR | |
268 ></TBODY | |
269 ></TABLE | |
270 ><P | |
271 ></P | |
272 ><P | |
273 >The following defines are also provided:</P | |
274 ><P | |
275 ></P | |
276 ><TABLE | |
277 BORDER="0" | |
278 ><TBODY | |
279 ><TR | |
280 ><TD | |
281 ><TT | |
282 CLASS="LITERAL" | |
283 >SDL_HAT_RIGHTUP</TT | |
284 ></TD | |
285 ></TR | |
286 ><TR | |
287 ><TD | |
288 ><TT | |
289 CLASS="LITERAL" | |
290 >SDL_HAT_RIGHTDOWN</TT | |
291 ></TD | |
292 ></TR | |
293 ><TR | |
294 ><TD | |
295 ><TT | |
296 CLASS="LITERAL" | |
297 >SDL_HAT_LEFTUP</TT | |
298 ></TD | |
299 ></TR | |
300 ><TR | |
301 ><TD | |
302 ><TT | |
303 CLASS="LITERAL" | |
304 >SDL_HAT_LEFTDOWN</TT | |
305 ></TD | |
306 ></TR | |
307 ></TBODY | |
308 ></TABLE | |
309 ><P | |
310 ></P | |
311 ></DIV | |
312 ><DIV | |
313 CLASS="REFSECT1" | |
314 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
315 NAME="AEN3998" |
0 | 316 ></A |
317 ><H2 | |
318 >See Also</H2 | |
319 ><P | |
320 ><A | |
321 HREF="sdlevent.html" | |
322 ><SPAN | |
323 CLASS="STRUCTNAME" | |
324 >SDL_Event</SPAN | |
325 ></A | |
326 >, | |
327 <A | |
328 HREF="joystick.html" | |
329 >Joystick Functions</A | |
330 >, | |
331 <A | |
332 HREF="sdljoystickeventstate.html" | |
333 ><TT | |
334 CLASS="FUNCTION" | |
335 >SDL_JoystickEventState</TT | |
336 ></A | |
337 >, | |
338 <A | |
339 HREF="sdljoystickgetball.html" | |
340 ><TT | |
341 CLASS="FUNCTION" | |
342 >SDL_JoystickGetHat</TT | |
343 ></A | |
344 ></P | |
345 ></DIV | |
346 ><DIV | |
347 CLASS="NAVFOOTER" | |
348 ><HR | |
349 ALIGN="LEFT" | |
350 WIDTH="100%"><TABLE | |
351 WIDTH="100%" | |
352 BORDER="0" | |
353 CELLPADDING="0" | |
354 CELLSPACING="0" | |
355 ><TR | |
356 ><TD | |
357 WIDTH="33%" | |
358 ALIGN="left" | |
359 VALIGN="top" | |
360 ><A | |
361 HREF="sdljoybuttonevent.html" | |
362 >Prev</A | |
363 ></TD | |
364 ><TD | |
365 WIDTH="34%" | |
366 ALIGN="center" | |
367 VALIGN="top" | |
368 ><A | |
369 HREF="index.html" | |
370 >Home</A | |
371 ></TD | |
372 ><TD | |
373 WIDTH="33%" | |
374 ALIGN="right" | |
375 VALIGN="top" | |
376 ><A | |
377 HREF="sdljoyballevent.html" | |
378 >Next</A | |
379 ></TD | |
380 ></TR | |
381 ><TR | |
382 ><TD | |
383 WIDTH="33%" | |
384 ALIGN="left" | |
385 VALIGN="top" | |
386 >SDL_JoyButtonEvent</TD | |
387 ><TD | |
388 WIDTH="34%" | |
389 ALIGN="center" | |
390 VALIGN="top" | |
391 ><A | |
392 HREF="eventstructures.html" | |
393 >Up</A | |
394 ></TD | |
395 ><TD | |
396 WIDTH="33%" | |
397 ALIGN="right" | |
398 VALIGN="top" | |
399 >SDL_JoyBallEvent</TD | |
400 ></TR | |
401 ></TABLE | |
402 ></DIV | |
403 ></BODY | |
404 ></HTML | |
405 > |