Mercurial > sdl-ios-xcode
annotate docs/html/audio.html @ 4167:a6f635e5eaa6 SDL-1.2
Fixed bug #611
From Tim Angus 2008-08-12 11:18:06
I'm one of the maintainers of ioquake3.org, an updated version of the
Quake 3 engine. Relatively recently, we moved ioq3 to use SDL as a
replacement for 95% of the platform specific code that was there. On the
whole it's doing a great job but unfortunately since the move we've been
getting complaints about the quality of the mouse input on the Windows
platform to the point where for many the game is unplayable. Put in
other terms, the current stable SDL 1.2 is basically not fit for purpose
if you need high quality mouse input as you do in a first person shooter.
Over the weekend I decided to pull my finger out and actually figure out
what's going on. There are basically two major problems. Firstly, when
using the "windib" driver, mouse input is gathered via the WM_MOUSEMOVE
message. Googling for this indicates that often this is known to result
in "spurious" and/or "missing" mouse movement events; this is the
primary cause of the poor mouse input. The second problem is that the
"directx" driver does not work at all in combination with OpenGL meaning
that you can't use DirectInput if your application also uses OpenGL. In
other words you're locked into using the "windib" driver and its poor
mouse input.
In order to address these problems I've done the following:
* Remove WM_MOUSEMOVE based motion event generation and replace with
calls to GetCursorPos which seems much more reliable. In order to
achieve this I've moved mouse motion out into a separate function that
is called once per DIB_PumpEvents.
* Remove the restriction on the "directx" driver being inoperable in
combination with OpenGL. There is a bug for this issues that I've
hijacked to a certain extent
(http://bugzilla.libsdl.org/show_bug.cgi?id=265). I'm the first to admit
I don't really understand why this restriction is there in the first
place. The commit message for the bug fix that introduced this
restriction (r581) isn't very elaborate and I couldn't see any other bug
tracking the issue. If anyone has more information on the bug that was
avoided by r581 it would be helpful as I/someone could then look into
addressing the problem without disabling the "directx" driver.
* I've also removed the restriction on not being allowed to use
DirectInput in windowed mode. I couldn't see any reason for this, at
least not from our perspective. I have my suspicions that it'll be
something like matching up the cursor with the mouse coordinates...
* I bumped up the DirectInput API used to version 7 in order to get
access to mouse buttons 4-7. I've had to inject a little bit of the DX7
headers into SDL there as the MinGW ones aren't up to date in this respect.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 02 Apr 2009 04:43:36 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >Audio</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_JoystickClose" | |
17 HREF="sdljoystickclose.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_AudioSpec" | |
20 HREF="sdlaudiospec.html"><META | |
21 NAME="KEYWORD" | |
22 CONTENT="audio"><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="sdljoystickclose.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="sdlaudiospec.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="AUDIO" | |
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 10. Audio</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="sdlaudiospec.html" | |
92 >SDL_AudioSpec</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
93 > -- Audio Specification Structure</DT |
0 | 94 ><DT |
95 ><A | |
96 HREF="sdlopenaudio.html" | |
97 >SDL_OpenAudio</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
98 > -- Opens the audio device with the desired parameters.</DT |
0 | 99 ><DT |
100 ><A | |
101 HREF="sdlpauseaudio.html" | |
102 >SDL_PauseAudio</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
103 > -- Pauses and unpauses the audio callback processing</DT |
0 | 104 ><DT |
105 ><A | |
106 HREF="sdlgetaudiostatus.html" | |
107 >SDL_GetAudioStatus</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
108 > -- Get the current audio state</DT |
0 | 109 ><DT |
110 ><A | |
111 HREF="sdlloadwav.html" | |
112 >SDL_LoadWAV</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
113 > -- Load a WAVE file</DT |
0 | 114 ><DT |
115 ><A | |
116 HREF="sdlfreewav.html" | |
117 >SDL_FreeWAV</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
118 > -- Frees previously opened WAV data</DT |
0 | 119 ><DT |
120 ><A | |
121 HREF="sdlaudiocvt.html" | |
122 >SDL_AudioCVT</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
123 > -- Audio Conversion Structure</DT |
0 | 124 ><DT |
125 ><A | |
126 HREF="sdlbuildaudiocvt.html" | |
127 >SDL_BuildAudioCVT</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
128 > -- Initializes a SDL_AudioCVT structure for conversion</DT |
0 | 129 ><DT |
130 ><A | |
131 HREF="sdlconvertaudio.html" | |
132 >SDL_ConvertAudio</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
133 > -- Convert audio data to a desired audio format.</DT |
0 | 134 ><DT |
135 ><A | |
136 HREF="sdlmixaudio.html" | |
137 >SDL_MixAudio</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
138 > -- Mix audio data</DT |
0 | 139 ><DT |
140 ><A | |
141 HREF="sdllockaudio.html" | |
142 >SDL_LockAudio</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
143 > -- Lock out the callback function</DT |
0 | 144 ><DT |
145 ><A | |
146 HREF="sdlunlockaudio.html" | |
147 >SDL_UnlockAudio</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
148 > -- Unlock the callback function</DT |
0 | 149 ><DT |
150 ><A | |
151 HREF="sdlcloseaudio.html" | |
152 >SDL_CloseAudio</A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
153 > -- Shuts down audio processing and closes the audio device.</DT |
0 | 154 ></DL |
155 ></DIV | |
156 ><P | |
157 >Sound on the computer is translated from waves that you hear into a series of | |
158 values, or samples, each representing the amplitude of the wave. When these | |
159 samples are sent in a stream to a sound card, an approximation of the original | |
160 wave can be recreated. The more bits used to represent the amplitude, and the | |
161 greater frequency these samples are gathered, the closer the approximated | |
162 sound is to the original, and the better the quality of sound.</P | |
163 ><P | |
164 >This library supports both 8 and 16 bit signed and unsigned sound samples, | |
165 at frequencies ranging from 11025 Hz to 44100 Hz, depending on the | |
166 underlying hardware. If the hardware doesn't support the desired audio | |
167 format or frequency, it can be emulated if desired (See | |
168 <A | |
169 HREF="sdlopenaudio.html" | |
170 ><TT | |
171 CLASS="FUNCTION" | |
172 >SDL_OpenAudio()</TT | |
173 ></A | |
174 >)</P | |
175 ><P | |
176 >A commonly supported audio format is 16 bits per sample at 22050 Hz.</P | |
177 ></DIV | |
178 ><DIV | |
179 CLASS="NAVFOOTER" | |
180 ><HR | |
181 ALIGN="LEFT" | |
182 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
183 SUMMARY="Footer navigation table" |
0 | 184 WIDTH="100%" |
185 BORDER="0" | |
186 CELLPADDING="0" | |
187 CELLSPACING="0" | |
188 ><TR | |
189 ><TD | |
190 WIDTH="33%" | |
191 ALIGN="left" | |
192 VALIGN="top" | |
193 ><A | |
194 HREF="sdljoystickclose.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
195 ACCESSKEY="P" |
0 | 196 >Prev</A |
197 ></TD | |
198 ><TD | |
199 WIDTH="34%" | |
200 ALIGN="center" | |
201 VALIGN="top" | |
202 ><A | |
203 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
204 ACCESSKEY="H" |
0 | 205 >Home</A |
206 ></TD | |
207 ><TD | |
208 WIDTH="33%" | |
209 ALIGN="right" | |
210 VALIGN="top" | |
211 ><A | |
212 HREF="sdlaudiospec.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
213 ACCESSKEY="N" |
0 | 214 >Next</A |
215 ></TD | |
216 ></TR | |
217 ><TR | |
218 ><TD | |
219 WIDTH="33%" | |
220 ALIGN="left" | |
221 VALIGN="top" | |
222 >SDL_JoystickClose</TD | |
223 ><TD | |
224 WIDTH="34%" | |
225 ALIGN="center" | |
226 VALIGN="top" | |
227 ><A | |
228 HREF="reference.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
229 ACCESSKEY="U" |
0 | 230 >Up</A |
231 ></TD | |
232 ><TD | |
233 WIDTH="33%" | |
234 ALIGN="right" | |
235 VALIGN="top" | |
236 >SDL_AudioSpec</TD | |
237 ></TR | |
238 ></TABLE | |
239 ></DIV | |
240 ></BODY | |
241 ></HTML | |
242 > |