~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/Documentation/sound/Introduction

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 Introduction    Notes on Modular Sound Drivers and Soundcore
  2 Wade Hampton 
  3 6/30/1999
  4 
  5 Purpose:  
  6 ========
  7 This document provides some general notes on the modular 
  8 sound drivers and their configuration, along with the 
  9 support modules sound.o, soundlow.o and soundcore.o.
 10 
 11 Note, some of this probably should be added to the Sound-HOWTO!
 12 
 13 
 14 Copying:
 15 ========
 16 none
 17 
 18 
 19 History:
 20 ========
 21 0.1.0  11/20/1998  First version, draft
 22 1.0.0  11/1998     Alan Cox changes, incorporation in 2.2.0
 23                    as /usr/src/linux/Documentation/sound/Introduction
 24 1.1.0  6/30/1999   Second version, added notes on making the drivers,
 25                    added info on multiple sound cards of similar types,]
 26                    added more diagnostics info, added info about esd.
 27                    added info on OSS and ALSA.
 28 1.1.1  19991031    Added notes on sound-slot- and sound-service.
 29                         (Alan Cox)
 30 1.1.2  20000920    Modified for Kernel 2.4 (Christoph Hellwig)
 31 
 32 
 33 Modular Sound Drivers:
 34 ======================
 35 
 36 Thanks to the GREAT work by Alan Cox (alan@lxorguk.ukuu.org.uk),
 37 
 38 [And Oleg Drokin, Thomas Sailer, Andrew Veliath and more than a few 
 39  others - not to mention Hannu's original code being designed well
 40  enough to cope with that kind of chopping up](Alan)
 41 
 42 the standard Linux kernels support a modular sound driver.  From
 43 Alan's comments in linux/drivers/sound/README.FIRST:
 44 
 45   The modular sound driver patches were funded by Red Hat Software 
 46   (www.redhat.com). The sound driver here is thus a modified version of 
 47   Hannu's code. Please bear that in mind when considering the appropriate
 48   forums for bug reporting.
 49 
 50 The modular sound drivers may be loaded via insmod or modprobe.  
 51 To support all the various sound modules, there are two general 
 52 support modules that must be loaded first:
 53  
 54    soundcore.o:   Top level handler for the sound system, provides
 55                   a set of functions for registration of devices
 56                   by type.
 57 
 58    sound.o:       Common sound functions required by all modules.
 59 
 60 For the specific sound modules (e.g., sb.o for the Soundblaster), 
 61 read the documentation on that module to determine what options
 62 are available, for example IRQ, address, DMA.
 63 
 64 Warning, the options for different cards sometime use different names 
 65 for the same or a similar feature (dma1= versus dma16=).  As a last 
 66 resort, inspect the code (search for MODULE_PARM).
 67 
 68 Notes:
 69 
 70 1.  There is a new OpenSource sound driver called ALSA which is
 71     currently under development:  http://www.alsa-project.org/
 72     I have not tried it nor am I aware of its status, but it is
 73     currently under development.
 74 
 75 2.  The commercial OSS driver may be obtained from the site:
 76     http://www/opensound.com.  This may be used for cards that
 77     are unsupported by the kernel driver, or may be used
 78     by other operating systems.  
 79 
 80 3.  The enlightenment sound daemon may be used for playing
 81     multiple sounds at the same time via a single card, eliminating
 82     some of the requirements for multiple sound card systems.  For
 83     more information, see:  http://www.tux.org/~ricdude/EsounD.html  
 84     The "esd" program may be used with the real-player and mpeg 
 85     players like mpg123 and x11amp.
 86 
 87 
 88 Building the Modules:
 89 =====================
 90 
 91 This document does not provide full details on building the 
 92 kernel, etc.  The notes below apply only to making the kernel
 93 sound modules.   If this conflicts with the kernel's README,
 94 the README takes precedence. 
 95 
 96 1.  To make the kernel sound modules, cd to your /usr/src/linux
 97     directory (typically) and type make config, make menuconfig, 
 98     or make xconfig (to start the command line, dialog, or x-based
 99     configuration tool).  
100 
101 2.  Select the Sound option and a dialog will be displayed.  
102 
103 3.  Select M (module) for "Sound card support".
104 
105 4.  Select your sound driver(s) as a module.  For ProAudio, Sound
106     Blaster, etc., select M (module) for OSS sound modules.
107     [thanks to marvin stodolsky <stodolsk@erols.com>]A
108 
109 5.  Make the kernel (e.g., make dep ; make bzImage), and install
110     the kernel.
111 
112 6.  Make the modules and install them (make modules; make modules_install).
113 
114 
115 
116 INSMOD:
117 =======
118 
119 If loading via insmod, the common modules must be loaded in the 
120 order below BEFORE loading the other sound modules.  The card-specific
121 modules may then be loaded (most require parameters).  For example,
122 I use the following via a shell script to load my SoundBlaster:
123 
124 SB_BASE=0x240
125 SB_IRQ=9
126 SB_DMA=3
127 SB_DMA2=5
128 SB_MPU=0x300
129 #
130 echo Starting sound
131 /sbin/insmod soundcore
132 /sbin/insmod soundlow
133 /sbin/insmod sound  
134 #
135 echo Starting sound blaster....
136 /sbin/insmod uart401
137 /sbin/insmod sb io=$SB_BASE irq=$SB_IRQ dma=$SB_DMA dma16=$SB_DMA2 mpu_io=$SB_MP
138 
139 When using sound as a module, I typically put these commands
140 in a file such as /root/soundon.sh.
141 
142 
143 MODPROBE:
144 =========
145 
146 If loading via modprobe, these common files are automatically loaded 
147 when requested by modprobe.  For example, my /etc/modules.conf contains:
148 
149 alias sound sb 
150 options sb io=0x240 irq=9 dma=3 dma16=5 mpu_io=0x300
151 
152 All you need to do to load the module is:
153 
154         /sbin/modprobe sb
155 
156 
157 Sound Status:
158 =============
159 
160 The status of sound may be read/checked by:
161         cat (anyfile).au >/dev/audio
162 
163 The status of the modules and which modules depend on 
164 which other modules may be checked by:
165         /sbin/lsmod
166 
167 /sbin/lsmod should show something like the following:
168         sb                     26280   0 
169         uart401                 5640   0  [sb]
170         sound                  57112   0  [sb uart401]
171         soundlow                 208   0  [sound]
172         soundcore               1968   8  [sb sound]
173 
174 
175 Removing Sound: 
176 =============== 
177 
178 Sound may be removed by using /sbin/rmmod in the reverse order
179 in which you load the modules.  Note, if a program has a sound device
180 open (e.g., xmixer), that module (and the modules on which it 
181 depends) may not be unloaded.
182 
183 For example, I use the following to remove my Soundblaster (rmmod
184 in the reverse order in which I loaded the modules):
185 
186 /sbin/rmmod sb
187 /sbin/rmmod uart401
188 /sbin/rmmod sound
189 /sbin/rmmod soundlow
190 /sbin/rmmod soundcore
191 
192 When using sound as a module, I typically put these commands
193 in a script such as /root/soundoff.sh.
194 
195 
196 Removing Sound for use with OSS: 
197 ================================ 
198 
199 If you get really stuck or have a card that the kernel modules
200 will not support, you can get a commercial sound driver from
201 http://www.opensound.com.  Before loading the commercial sound
202 driver, you should do the following:
203 
204 1.  remove sound modules (detailed above)
205 2.  remove the sound modules from /etc/modules.conf
206 3.  move the sound modules from /lib/modules/<kernel>/misc
207     (for example, I make a /lib/modules/<kernel>/misc/tmp
208     directory and copy the sound module files to that 
209     directory).
210 
211 
212 Multiple Sound Cards:
213 =====================
214 
215 The sound drivers will support multiple sound cards and there
216 are some great applications like multitrack that support them.  
217 Typically, you need two sound cards of different types.  Note, this
218 uses more precious interrupts and DMA channels and sometimes 
219 can be a configuration nightmare.  I have heard reports of 3-4
220 sound cards (typically I only use 2).
221 
222 On my machine I have two sound cards (cs4232 and Soundblaster Vibra
223 16).  By loading sound as modules, I can control which is the first
224 sound device (/dev/dsp, /dev/audio, /dev/mixer) and which is 
225 the second.  Normally, the cs4232 (Dell sound on the motherboard) 
226 would be the first sound device, but I prefer the Soundblaster.  
227 All you have to do is to load the one you want as /dev/dsp 
228 first (in my case "sb") and then load the other one
229 (in my case "cs4232").
230 
231 If you have two cards of the same type that are jumpered 
232 cards or different PnP revisions, you may load the same 
233 module twice.  For example, I have a SoundBlaster vibra 16
234 and an older SoundBlaster 16 (jumpers).  To load the module
235 twice, you need to do the following:
236 
237 1.  Copy the sound modules to a new name.  For example
238     sb.o could be copied (or symlinked) to sb1.o for the
239     second SoundBlasster.
240 
241 2.  Make a second entry in /etc/modules.conf, for example,
242     sound1 or sb1.  This second entry should refer to the
243     new module names for example sb1, and should include
244     the I/O, etc. for the second sound card.
245 
246 3.  Update your soundon.sh script, etc.
247 
248 Warning:  I have never been able to get two PnP sound cards of the
249 same type to load at the same time.  I have tried this several times
250 with the Soundblaster Vibra 16 cards.  OSS has indicated that this
251 is a PnP problem....  If anyone has any luck doing this, please 
252 send me an E-MAIL.  PCI sound cards should not have this problem.a
253 Since this was originally release, I have received a couple of 
254 mails from people who have accomplished this!
255 
256 NOTE: In Linux 2.4 the Sound Blaster driver (and only this one yet)
257 supports multiple cards with one module by default.
258 Read the file 'Soundblaster' in this directory for details.
259 
260 Sound Problems:
261 ===============
262 
263 First RTFM (including the troubleshooting section 
264 in the Sound-HOWTO). 
265 
266 1)  If you are having problems loading the modules (for
267     example, if you get device conflict errors) try the
268     following:
269 
270   A)  If you have Win95 or NT on the same computer,  
271       write down what addresses, IRQ, and DMA channels
272       those were using for the same hardware.  You probably 
273       can use these addresses, IRQs, and DMA channels.
274       You should really do this BEFORE attempting to get
275       sound working!
276   
277   B)  Check (cat) /proc/interrupts, /proc/ioports,
278       and /proc/dma.  Are you trying to use an address,
279       IRQ or DMA port that another device is using?
280   
281   C)  Check (cat) /proc/isapnp
282   
283   D)  Inspect your /var/log/messages file.  Often that will 
284       indicate what IRQ or IO port could not be obtained.
285   
286   E)  Try another port or IRQ.  Note this may involve 
287       using the PnP tools to move the sound card to 
288       another location.  Sometimes this is the only way 
289       and it is more or less trial and error.
290 
291 2)  If you get motor-boating (the same sound or part of a 
292     sound clip repeated), you probably have either an IRQ
293     or DMA conflict.  Move the card to another IRQ or DMA
294     port.  This has happened to me when playing long files 
295     when I had an IRQ conflict.
296 
297 3.  If you get dropouts or pauses when playing high sample
298     rate files such as using mpg123 or x11amp/xmms, you may 
299     have too slow of a CPU and may have to use the options to 
300     play the files at 1/2 speed.  For example, you may use
301     the -2 or -4 option on mpg123.  You may also get this
302     when trying to play mpeg files stored on a CD-ROM
303     (my Toshiba T8000 PII/366 sometimes has this problem).
304 
305 4.  If you get "cannot access device" errors, your /dev/dsp
306     files, etc. may be set to owner root, mode 600.  You 
307     may have to use the command:
308       chmod 666 /dev/dsp /dev/mixer /dev/audio
309 
310 5.  If you get "device busy" errors, another program has the
311     sound device open.  For example, if using the Enlightenment
312     sound daemon "esd", the "esd" program has the sound device.
313     If using "esd", please RTFM the docs on ESD.  For example,
314     esddsp <program> may be used to play files via a non-esd
315     aware program.
316 
317 
318 6)  Ask for help on the sound list or send E-MAIL to the
319     sound driver author/maintainer.
320 
321 7)  Turn on debug in drivers/sound/sound_config.h (DEB, DDB, MDB).
322 
323 8)  If the system reports insufficient DMA memory then you may want to
324     load sound with the "dmabufs=1" option. Or in /etc/conf.modules add
325         
326         preinstall sound dmabufs=1
327 
328     This makes the sound system allocate its buffers and hang onto them.
329 
330 Configuring Sound:
331 ==================
332 
333 There are several ways of configuring your sound:
334 
335 1)  On the kernel command line (when using the sound driver(s)
336     compiled in the kernel). Check the driver source and
337     documentation for details.
338 
339 2)  On the command line when using insmod or in a bash script
340     using command line calls to load sound.
341 
342 3)  In /etc/modules.conf when using modprobe.
343 
344 4)  Via Red Hat's GPL'd /usr/sbin/sndconfig program (text based).
345 
346 5)  Via the OSS soundconf program (with the commercial version
347     of the OSS driver.
348 
349 6)  By just loading the module and let isapnp do everything relevant
350     for you. This works only with a few drivers yet and - of course -
351     only with isapnp hardware.
352 
353 And I am sure, several other ways.  
354 
355 Anyone want to write a linuxconf module for configuring sound?
356 
357 Module Loading:
358 ===============
359 
360 When a sound card is first referenced and sound is modular the sound system
361 will ask for the sound devices to be loaded. Initially it requests that
362 the driver for the sound system is loaded. It then will ask for 
363 sound-slot-0, where 0 is the first sound card. (sound-slot-1 the second and
364 so on). Thus you can do
365 
366 alias sound-slot-0 sb
367 
368 To load a soundblaster at this point. If the slot loading does not provide
369 the desired device - for example a soundblaster does not directly provide
370 a midi synth in all cases then it will request "sound-service-0-n" where n
371 is
372 
373 0       Mixer
374 
375 2       MIDI
376 
377 3, 4    DSP audio
378 
379 
380 For More Information (RTFM):
381 ============================
382 1)  Information on kernel modules:  linux/Documentation/modules.txt
383     and manual pages for insmod and modprobe.
384 
385 2)  Information on PnP, RTFM manual pages for isapnp.
386 
387 3)  Sound-HOWTO and Sound-Playing-HOWTO.
388 
389 4)  OSS's WWW site at http://www.opensound.com.
390 
391 5)  All the files in linux/Documentation/sound.
392 
393 6)  The comments and code in linux/drivers/sound.
394 
395 7)  The sndconfig and rhsound documentation from Red Hat.
396 
397 8)  The Linux-sound mailing list:  sound-list@redhat.com.
398 
399 9)  Enlightenment documentation (for info on esd)
400     http://www.tux.org/~ricdude/EsounD.html.
401 
402 10) ALSA home page:  http://www.alsa-project.org/
403 
404 
405 Contact Information:
406 ====================
407 Wade Hampton:  (whampton@staffnet.com)

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.