Using ALSA device driver directly

Chris Bagwell chris at cnpbagwell.com
Sat Jun 11 04:34:04 UTC 2005


Hi all,

I'm looking for some feedback on enhancing ALSA support in the SoX package.
Specifically, I'd like to allow the Fedora SoX RPM package to include
support for both ALSA and OSS drivers.  Currently, it only supports
OSS driver.

The SoX package has had an ALSA driver for playing/recording audio for
years now but it wasn't until Redhat/Fedora started including ALSA
drivers that I really became interested in developing it further.

The original author of the SoX ALSA driver chose to directly access
the kernel device driver instead of the alsa-devel library.  The may reason
was because it seemed like bloatware to wrap such simple ioctl() calls.

The main problem with using ALSA ioctl's is that compared to OSS audio 
device,
its been a nightmare supporting the ever changing ALSA device header 
files. Its
even harder trying to get it to compile on a Fedora.

Here some issues with packages that access ALSA device drivers directly:

1) OSS's interface is defined in sys/soundcard.h which is in the
glibc-headers package.  Chances are great that you can compile against it.

The equivalent file for ALSA is sound/asound.h but this is not distributed
in any convient package like glibc-headers.  Anyone know if this
will ever be distributed in glibc-headers?

2) sound/asound.h is available from /lib/modules/*/build/include/ though.
Is it OK for a RPM to BuildRequires: kernel?

The current rawhide package of SoX has a patch to remove a hack I added
to point to kernel headers to get ALSA to compile.  So I'm guessing its
not a preferred approach then?

3) If your package uses the kernel sound/asound.h file, it won't
compile most likely.  Thats because the header eventually includes
linux/compiler.h.  Include path order will grab 
/usr/include/linux/compiler.h
first which doesn't define __user or __kernel.  
The linux kernel version of sound/asound.h references that extensively.

Whats the easiest way around include path ordering so that it prefers
the kernels compiler.h?

4) Should I drop all this and just use alsa-lib instead?

Chris
(SoX mantainer)




More information about the Fedora-maintainers mailing list