Re: Kernel OSS vs ALSA

Paul Menage (Paul.Menage@cl.cam.ac.uk)
Thu, 14 Oct 1999 19:59:14 +0100


In article <m33dveghaf.fsf@graviton.subatomic.org>, you write:
>Thomas Sailer <sailer@ife.ee.ethz.ch> writes:
>
>> > * simultaneous multiple streams, with mixing as needed
>>
>> User space IMO
>
>Bad idea IMO. For highly interactive applications (eg games, but also
>more
>serious applications of VR) you don't want to take (a minimum of) a full
>context switch before the sound card even has a prayer of seeing a new
>audio sample. It's just not reasonable to restrict access to the audio
>hw
>to one process (telephony while playing MP3s is a good place you want two
>or more processes using the audio hw at once), and if you want to mix
>that
>in userspace you're going to need a separate daemon process to do that.
>

If you're allowing applications to play audio data, then unless you
have a very cunning mixer daemon, you're trusting them not to drown
each other out with white noise. In which case, why not map the
soundcard's DMA buffer into the address space of each application
that's using the card, and let each application do its own mixing?
(i.e. the app gets told what volume it's meant to be playing at, scales
its output accordingly, and just adds each sample to the current
contents of the next slot in the buffer. On an SMP machine this
obviously has some drawbacks, but on a UP machine it can work well.

See http://www.cl.cam.ac.uk/~dr10009/audio/ for an implementation of
this technique.

Paul

-- 
Paul Menage    Paul.Menage@cl.cam.ac.uk  http://www.cl.cam.ac.uk/~pbm1001/
Magdalene College, Cambridge:                               (01223) 768063 
Atlas Room, University of Cambridge Computer Laboratory:    (01223) 331859

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/