Hi, On Sat, May 22, 2010 at 9:52 PM, Brandon Kuczenski <brandon.kuczenski at 301south.net> wrote: > Hi, > > I'm using pulseaudio in per-user mode (as directed). ?From firefox I visited > a webpage with an embedded java applet (Text Twist from notoriously > unfriendly yahoo!) and found that java has seized control of /dev/dsp. > ?pulseaudio applications which typically work quite well are now unhappy. > > Is there a workaround to this ? ?I would rather have silent java apps than > have java kill sound for other programs. Let me give you some background on why this is happening. /dev/dsp is an OSS (Open Sound System) device. OSS is a legacy sound API that is not supported on newer distros. The fact that OSS works on your system *probably* means that you have the Linux kernel module snd-pcm-oss (and friends) loaded. This module is part of ALSA; it's OSSv3 emulation. This is the default on many distros, old and new, but it is slowly being phased out. The reason your PulseAudio apps don't work while snd-pcm-oss is playing audio is because ALSA, at the low level, can only play sound from one app at a time. *Part of* the reason for Pulseaudio's existence is to solve this problem, by providing software mixing in userspace. Since snd-pcm-oss is implemented at a lower level than Pulseaudio, it has no way to be aware of Pulse's software mixing, so it "hogs" your sound device. There are several ways to get part of what you want, or go for the "robust solution", depending on how much effort you want to put in, and the desired effect. 1. The easy solution -- to stop ALSA's OSS emulation -- is to remove the snd-pcm-oss module and all the modules that depend on it, from your Linux kernel. For one boot, you can do this with modprobe -r or rmmod. If you just do that, snd-pcm-oss will reappear when you reboot. You can then edit your module settings configuration file (usually /etc/modprobe.d/blacklist or /etc/modprobe.d/options) and prevent the modules from loading at all, by adding an "install" line. The effect of this first solution is that all OSS applications will simply not play sound. Pulseaudio will continue to work. 2. Similar effect to the first solution, but this can be used if (for some reason) you have snd-pcm-oss compiled directly into your kernel, and you don't want to recompile it. Edit /etc/pulse/default.pa and remove or comment the line: load-module module-suspend-on-idle The effect of this is to cause Pulseaudio to retain control over the ALSA device. This way, when snd-pcm-oss tries to play OSS sound, it will fail, because the device is already in use. This will result in a degradation of battery life if you are using a battery-powered device; hence, it is really not recommended unless you have an AC-powered device and don't care about your sound card being "busy" all the time. If it is feasible for you to use the first solution instead, please do so. 3. The really robust solution is to use OSS Proxy (see http://www.kernel.org/pub/linux/kernel/people/tj/ossp/ ), which simulates a /dev/dsp device in (mostly) userspace. This is a new, in-development solution for the long-standing problem of using the legacy OSS API on top of Pulseaudio, while preserving the software mixing features of PA. The instructions for installing osspd depend on how recent your kernel is, whether you have CUSE already, whether your ALSA OSS emulation grabs the OSS memory locations (yours probably does), and other factors. So because it's complex, I won't cover it here; mail me off-list if you can't figure it out. 4. The long-term ideal solution would be to have Java itself output directly to Pulseaudio. But if you are not a software engineer with the knowledge to implement this, one of the three above solutions is required for the time being. So, in summary: if you don't have the time/skills to develop a Pulseaudio output for the Java Sound API, then use Solution 1 if you don't care whether Java plays sound; use Solution 3 if you really want Java to play sound; and use Solution 2 if you have no other choice. Best, Sean > > Thanks, > Brandon > _______________________________________________ > pulseaudio-discuss mailing list > pulseaudio-discuss at mail.0pointer.de > https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss >