[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Linux sound
Jeff Read wrote:
> > Write it up and post it to this mailing list. If it is very bad,
> > I'm sure there are enough people here who'll spot obvious errors. As to
> > "Is using /dev/dsp the best thing?" question, you are right. There is so
> > little on Linux sound that it is a hard question for me to answer.
>
> /dev/dsp is currently the best general purpose option for sound under
> Linux. ALSA, the Advanced Linux Sound Architecture, extends the
> functionality of /dev/dsp considerably, but it is not yet a standard
> part of the Linux kernel architecture.
I see more and more of things like 'esd' and other sound daemons, and
also many games uses a separate process or thread to manage the sound
output to /dev/dsp.
But we decided upon another path. We didn't want to use anything else
than /dev/dsp directly, because the sound daemons aren't very standard
right now. But the general way of doing it via a subprocess and a pipe
(or shared memory) wasn't very appealing either. Most people took it
from Doom I think, and even with Doom, there was problems with the sound
lagging behind, as the pipe needed flushing and a context switch had to
happen before the sound was actually sent to the sound card. I would
assume that the sound daemon approach also has this problem.
After reading the .plan of zoid@idsoftware.com one time, we decided to
do it like Quake2 does it, in a single process, with calls to a
"process_sound" subroutine "sparkled" over the code (we didn't have to
sparkle very much, we call it at every end of video frame and it seems
to suffice). This process_sound subroutine uses an ioctl to check
whether /dev/dsp can take another buffer of sound data, and if so, mixes
and send the data. If it doesn't have any free buffer, process_sound
returns without doing anything.
So the sound in Quadra seems fine and in any case, it does work, but I
was still wondering after hacking that thing if that was the best way to
do this?
--
Pierre Phaneuf
Ludus Design, http://ludusdesign.com/
"First they ignore you. Then they laugh at you.
Then they fight you. Then you win." -- Gandhi