[Alsa-user] write() blocking for short sound streams
Brought to you by:
perex
From: Fredrik T. <fr...@do...> - 2003-09-18 19:31:54
|
Hello, I have recently started to migrate to Linux 2.6, and since ALSA came with it, I though that I might just as well give it a try, since I've heard so many great things about it. However, my first experiences have not been that positive. I'm guessing that most things are merely configuration options, but since I'm all new to ALSA, I hope that someone here can help me out a bit. I have a SB Live 5.1, and I'm using the ALSA framework and snd-emu10k1 driver from the unmodified linux-2.6.0-test4 sources. The most annoying thing is that sounds seem to be serialized, ie. if one process plays something through the OSS DSP device, any other process that also tries to play through the OSS DSP device blocks until the first process is done. An strace revealed that it is the write() calls that are blocking. ps also reveals that the kernel is sleeping in down(). To make things stranger, it seems that only "short" streams are blocking. When I have, for example, an MP3 playing through /dev/dsp, other processes can play sounds simultaneously (but those that play short streams still block each other). What the difference between a "short" and a "long" stream is, I can't really determine, though. I have only tried with the OSS DSP, since I don't know how to play PCM sound natively with ALSA. I tried some of the pcm* devices in /dev/snd, but none yielded any sound output. If someone can tell me what device to use, then I can try that too. Is that just some configuration thing that I have missed anywhere, or is it "built in" to ALSA? In the latter case, why would you want it that way? I commonly play several streams at once, since I have configured by remote control (through LIRC), to emit certain sounds when I press different buttons, as a "confirmation" sound, so to speak. Since I no longer get any sound immediately when I press the buttons, it no longer works as intended and I get no confirmation. Also, some streams make the speakers "click" when they start playing. I know that it is not in the streams themselves, since they didn't "click" with OSS, and they only "click" some times, not always. A smaller problem, but still a bit annoying, is that when I use sox to play some streams directly to /dev/dsp, they get these slightly distorted sound when I don't play at the "standard" sample rates (ie. 44100, 22050 and so on), as if sox had to manually convert the sample rates because the DSP device only gives it standard sampling rates. I suspect this is a driver problem, but it didn't happen with OSS driver, so I know that it's not the sound card. It's not something that I can't live with anyway. I just thought that at least someone might know the reason. Sorry for writing so much; I hope you can bear with me. Fredrik Tolf |