Mercurial > sdl-ios-xcode
annotate docs/html/audio.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 | 55f1f1b3e27d |
children | 355632dca928 |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >Audio</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_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 | |
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="sdljoystickclose.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="sdlaudiospec.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="AUDIO" | |
77 >Chapter 10. Audio</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="sdlaudiospec.html" | |
89 >SDL_AudioSpec</A | |
90 > — Audio Specification Structure</DT | |
91 ><DT | |
92 ><A | |
93 HREF="sdlopenaudio.html" | |
94 >SDL_OpenAudio</A | |
95 > — Opens the audio device with the desired parameters.</DT | |
96 ><DT | |
97 ><A | |
98 HREF="sdlpauseaudio.html" | |
99 >SDL_PauseAudio</A | |
100 > — Pauses and unpauses the audio callback processing</DT | |
101 ><DT | |
102 ><A | |
103 HREF="sdlgetaudiostatus.html" | |
104 >SDL_GetAudioStatus</A | |
105 > — Get the current audio state</DT | |
106 ><DT | |
107 ><A | |
108 HREF="sdlloadwav.html" | |
109 >SDL_LoadWAV</A | |
110 > — Load a WAVE file</DT | |
111 ><DT | |
112 ><A | |
113 HREF="sdlfreewav.html" | |
114 >SDL_FreeWAV</A | |
115 > — Frees previously opened WAV data</DT | |
116 ><DT | |
117 ><A | |
118 HREF="sdlaudiocvt.html" | |
119 >SDL_AudioCVT</A | |
120 > — Audio Conversion Structure</DT | |
121 ><DT | |
122 ><A | |
123 HREF="sdlbuildaudiocvt.html" | |
124 >SDL_BuildAudioCVT</A | |
125 > — Initializes a SDL_AudioCVT structure for conversion</DT | |
126 ><DT | |
127 ><A | |
128 HREF="sdlconvertaudio.html" | |
129 >SDL_ConvertAudio</A | |
130 > — Convert audio data to a desired audio format.</DT | |
131 ><DT | |
132 ><A | |
133 HREF="sdlmixaudio.html" | |
134 >SDL_MixAudio</A | |
135 > — Mix audio data</DT | |
136 ><DT | |
137 ><A | |
138 HREF="sdllockaudio.html" | |
139 >SDL_LockAudio</A | |
140 > — Lock out the callback function</DT | |
141 ><DT | |
142 ><A | |
143 HREF="sdlunlockaudio.html" | |
144 >SDL_UnlockAudio</A | |
145 > — Unlock the callback function</DT | |
146 ><DT | |
147 ><A | |
148 HREF="sdlcloseaudio.html" | |
149 >SDL_CloseAudio</A | |
150 > — Shuts down audio processing and closes the audio device.</DT | |
151 ></DL | |
152 ></DIV | |
153 ><P | |
154 >Sound on the computer is translated from waves that you hear into a series of | |
155 values, or samples, each representing the amplitude of the wave. When these | |
156 samples are sent in a stream to a sound card, an approximation of the original | |
157 wave can be recreated. The more bits used to represent the amplitude, and the | |
158 greater frequency these samples are gathered, the closer the approximated | |
159 sound is to the original, and the better the quality of sound.</P | |
160 ><P | |
161 >This library supports both 8 and 16 bit signed and unsigned sound samples, | |
162 at frequencies ranging from 11025 Hz to 44100 Hz, depending on the | |
163 underlying hardware. If the hardware doesn't support the desired audio | |
164 format or frequency, it can be emulated if desired (See | |
165 <A | |
166 HREF="sdlopenaudio.html" | |
167 ><TT | |
168 CLASS="FUNCTION" | |
169 >SDL_OpenAudio()</TT | |
170 ></A | |
171 >)</P | |
172 ><P | |
173 >A commonly supported audio format is 16 bits per sample at 22050 Hz.</P | |
174 ></DIV | |
175 ><DIV | |
176 CLASS="NAVFOOTER" | |
177 ><HR | |
178 ALIGN="LEFT" | |
179 WIDTH="100%"><TABLE | |
180 WIDTH="100%" | |
181 BORDER="0" | |
182 CELLPADDING="0" | |
183 CELLSPACING="0" | |
184 ><TR | |
185 ><TD | |
186 WIDTH="33%" | |
187 ALIGN="left" | |
188 VALIGN="top" | |
189 ><A | |
190 HREF="sdljoystickclose.html" | |
191 >Prev</A | |
192 ></TD | |
193 ><TD | |
194 WIDTH="34%" | |
195 ALIGN="center" | |
196 VALIGN="top" | |
197 ><A | |
198 HREF="index.html" | |
199 >Home</A | |
200 ></TD | |
201 ><TD | |
202 WIDTH="33%" | |
203 ALIGN="right" | |
204 VALIGN="top" | |
205 ><A | |
206 HREF="sdlaudiospec.html" | |
207 >Next</A | |
208 ></TD | |
209 ></TR | |
210 ><TR | |
211 ><TD | |
212 WIDTH="33%" | |
213 ALIGN="left" | |
214 VALIGN="top" | |
215 >SDL_JoystickClose</TD | |
216 ><TD | |
217 WIDTH="34%" | |
218 ALIGN="center" | |
219 VALIGN="top" | |
220 ><A | |
221 HREF="reference.html" | |
222 >Up</A | |
223 ></TD | |
224 ><TD | |
225 WIDTH="33%" | |
226 ALIGN="right" | |
227 VALIGN="top" | |
228 >SDL_AudioSpec</TD | |
229 ></TR | |
230 ></TABLE | |
231 ></DIV | |
232 ></BODY | |
233 ></HTML | |
234 > |