You are not logged in.

#1 2012-02-11 04:58:52

Jindur
Member
Registered: 2011-09-29
Posts: 184

Java/OpenJDK problem with OSS/osspd/ALSA/pulseaudio [SOLVED]

I've got problems with sound output of java programs, which usually try to hog /dev/dsp, using pulseaudio and openjdk 7.
Some rare java apps' sound methods surprisingly do work. Others (which the majority of java programs seem to use) do not. In Sun Java I could make those work by using 'padsp', however this method apparently fails on Archlinux with both latest Oracle Java (formerly worked on Ubuntu w/ Sun Java 6) and with OpenJDK too.
So I tried 'osspd' (package is called 'ossp') and it shows the root process "/usr/sbin/osspd --dsp-slave=/usr/sbin/ossp-padsp" been started, but the java applications will still not provide sound which I find pretty odd. I tried adding 'soundcore.preclaim_oss=0' to the 'kernel..' line in my grub's menu.lst, but that didn't help either.

Last edited by Jindur (2012-05-20 02:59:20)

Offline

#2 2012-05-20 02:42:26

Jindur
Member
Registered: 2011-09-29
Posts: 184

Re: Java/OpenJDK problem with OSS/osspd/ALSA/pulseaudio [SOLVED]

It's been quite a while, but I finally found a solution (read: big ugly hack).
Someone literally created a biguglyhack and posted it here:

http://lifein19x19.com/forum/viewtopic. … 243#p98243
(downloadable file there: javadummymixer_biguglyhack.zip [12.97 KiB] -> rename it from .zip to .jar and move it into your java's lib/ext folder -> profit!)

I applied it to OpenJDK 6 (should be same for 7 though) and all my java sound works flawlessly now, with pulseaudio, without any need for padsp stuff or osspd or whatever.

My sound.properties file reads:
javax.sound.sampled.Clip=com.sun.media.sound.DirectAudioDeviceProvider
javax.sound.sampled.Port=com.sun.media.sound.PortMixerProvider
javax.sound.sampled.SourceDataLine=com.sun.media.sound.DirectAudioDeviceProvider
javax.sound.sampled.TargetDataLine=com.sun.media.sound.DirectAudioDeviceProvider
but actually I'm not sure whether that even matters at all.

(Side note: The linked thread also mentions a "-D.sun.." command-line parameter that supposedly forces java to avoid disfunctional audio methods. The above biguglyhack however worked for me without any need of applying that command-line parameter.)

Last edited by Jindur (2012-05-20 02:58:05)

Offline

Board footer

Powered by FluxBB