Re: Reason for sound dropouts found

Pavel Machek (pavel@bug.ucw.cz)
Fri, 12 Mar 1999 23:39:31 +0100


Hi!

> There are several ways to solve this problem:
>
> 2. Every program to play sound should have two threads
> for reading and writing and an internal buffer which never
> gets empty so that after finishing one write() to the
> sound device the next write() can start immidiate without
> delay. --> no dropout
> This could be done also by a sound demon used by all
> sound programms. When this user buffer swaps out,
> you get your dropouts aggain.

I believe this is what splay does.

http://adam.kaist.ac.kr/~jwj95/splay-0.8.2.tar.gz

And it _still_ fails if you force machine into swap so much that it
has to swap player out - at which point it is unusable.

> 3. The internal dma buffer of the sound driver could be
> enlarged. When the dma buffer is big enough the sound
> card would play from this buffer during waits for the
> read(). --> no dropout

There's no need for this to be DMA buffer. Kernel could store audio
data in linklist of 4K buffers and copy them to DMA buffer as
needed. It could also include lo/hi watermarks: If there is less than
.5meg of audio data, wake userland. Block userland if there is more
than 1meg of audio data available.

This should give good sound. Hmm, and I even believe this is the
easiest yet working solution.

Pavel

-- 
I'm really pavel@atrey.karlin.mff.cuni.cz. 	   Pavel
Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).

- 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/