Cannot play my music when watching playing java games

Bug #209198 reported by Matt
32
This bug affects 5 people
Affects Status Importance Assigned to Milestone
pulseaudio (Ubuntu)
Confirmed
Low
Unassigned
sun-java6 (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: pulseaudio

Just so you know *sound does work* (Intel 82801H (ICH8 Family) HD Audio Controller)

I can play music fine, I can play java and flash videos fine, but not music + java or java + flash or flash + sound at the same time as sound on one application won't work.

When I am playing java games (sound muted). sound either doesn't play on some music players or causes Amarok to crash. Also flash videos won't play for more than 2 seconds when I am playing java games, or listening to music.

I have set sound to use pulseaudio in sys > pref > sound and by running "asoundconf set-pulseaudio"

Before I ran this command, sound rarely worked properly, and pulseaudio has definitely improved this problem.

Does anyone know what's going on?

I am running an up-to-date Hardy Beta 32bit install.

Thanks!

Revision history for this message
Frederik Seidelin (frederikseidelin) wrote :

I've replied to the thread also concerning this problem on Ubuntu Forums: http://ubuntuforums.org/showthread.php?t=739893

In short, audio works for me if I use the ALSA controller, but not if I use the Intel controller, so it seems that the problem is related to the latter.

Revision history for this message
Matt (mattbutler-2) wrote :

If I do that I get the following error message when I hit "Test,"no go for me.
 so its a
gconfaudiosrc ! audioconvert ! audioresample ! gconfaudiosink profile=chat: Could not open audio device for playback.

Revision history for this message
Matt (mattbutler-2) wrote :

Update:

In FF3b5 when I try to play a java game and flash video at the same time, I get the following error in syslog:

[quote]pulseaudio[5704]: module-alsa-sink.c: Error opening PCM device front:0: Device or resource busy[/quote]

Revision history for this message
John Pham (jhnphm) wrote :

Workaround:

Move or remove /usr/lib/jvm/java-6-sun/jre/lib/amd64/libjsoundalsa.so (for AMD64) or /usr/lib/jvm/java-6-sun/jre/lib/i386/libjsoundalsa.so (for 32 bit) and run Firefox, or anything that calls or runs Java w/ "padsp [appname]"

For firefox you can set in /etc/firefox-3.0/firefoxrc FIREFOX_DSP="padsp"

There doesn't seem to be a good reason not to have FIREFOX_DSP set to padsp by default, since it doesn't affect alsa-using plugins in any way.

However, any launch scripts probably should have checks to see if padsp exists to be more robust, in the event someone uninstalls pulseaudio due to frustrations.

This probably should somehow be implemented by default using a launcher script for Java, like the pasuspender in qjackctl.

Revision history for this message
John Pham (jhnphm) wrote :

One potential caveat of the above is if the java app opens large files > 2GB, since I recall the aoss wrapper breaking VMWare when it read large disk image files.

Revision history for this message
tpad (tomasapinho) wrote :

I've found a way to solve this problem for ones that don't really have a firefoxrc file. All you have to do is edit all firefox shortcuts and add padsp before the actual command. So the menu one would run this: padsp firefox %u . Hoping the developers will either change the shortcuts soon or find some other solution in firefox code.

Hav fun linuxing,
tpad

Revision history for this message
Patricio (patricio-stwing) wrote :

I set FIREFOX_DSP="padsp" in /etc/firefox-3.0/firefoxrc
but it did not help.
I was force to call firefox using "padsp firefox" in the command line.
I used this to test the java sound: http://www.javasonics.com/listenup/examples/play_welcome.html
OSS emulation nows shows up in the PulseAudio Volume Control when java plays a sound.
So it works, I can play yahoo games (chess for example) with sound.
In other words, I confirm this bug.

Changed in pulseaudio:
status: New → Confirmed
Daniel T Chen (crimsun)
Changed in pulseaudio:
importance: Undecided → Low
Revision history for this message
pitx (pitxsb12) wrote :

Hi i got same bug in ubuntu 9.04 and ubuntu 9.10 with firefox3.5 and Java6.0.15. The Java sounds not work if other program included flash are running on system. And if first i use Java so the other programs not play music.

This is the syslog:
Oct 27 13:46:14 pitx-ubuntu-9 pulseaudio[1734]: alsa-sink.c: Error opening PCM device front:0: Dispositivo ó recurso ocupado
Oct 27 13:46:14 pitx-ubuntu-9 pulseaudio[1734]: alsa-sink.c: Error opening PCM device front:0: Dispositivo ó recurso ocupado
Oct 27 13:46:19 pitx-ubuntu-9 pulseaudio[1734]: alsa-sink.c: Error opening PCM device front:0: Dispositivo ó recurso ocupado
Oct 27 13:46:20 pitx-ubuntu-9 pulseaudio[1734]: alsa-sink.c: Error opening PCM device front:0: Dispositivo ó recurso ocupado
Oct 27 13:46:24 pitx-ubuntu-9 pulseaudio[1734]: alsa-sink.c: Error opening PCM device front:0: Dispositivo ó recurso ocupado
Oct 27 13:46:24 pitx-ubuntu-9 pulseaudio[1734]: sink-input.c: Failed to create sink input: sink is suspended.
Oct 27 13:47:08 pitx-ubuntu-9 pulseaudio[1734]: ratelimit.c: 52 events suppressed
Oct 27 14:01:57 pitx-ubuntu-9 pulseaudio[1734]: alsa-sink.c: Error opening PCM device front:0: Dispositivo ó recurso ocupado
Oct 27 14:01:57 pitx-ubuntu-9 pulseaudio[1734]: alsa-sink.c: Error opening PCM device front:0: Dispositivo ó recurso ocupado
Oct 27 14:02:17 pitx-ubuntu-9 pulseaudio[1734]: alsa-sink.c: Error opening PCM device front:0: Dispositivo ó recurso ocupado
Oct 27 14:02:17 pitx-ubuntu-9 pulseaudio[1734]: sink-input.c: Failed to create sink input: sink is suspended.

This is console JAVA menssage:

ListenUp: 0.000, ListenUp version = V1.94 (build 443, Thu Sep 03 00:00:00 CEST 2009)
ListenUp license issued on Sun Feb 18 00:00:00 CET 2007
ListenUp: 0.983, start downloading http://www.javasonics.com/listenup/examples/welcome.wav
com.softsynth.javasonics.DeviceUnavailableException: javax.sound.sampled.LineUnavailableException: Audio Device Unavailable
 at com.softsynth.javasonics.p.open(p.java:76)
 at com.softsynth.javasonics.recplay.bb.i(bb.java:231)
 at com.softsynth.javasonics.recplay.bb.f(bb.java:609)
 at com.softsynth.javasonics.recplay.bb.g(bb.java:738)
 at com.softsynth.javasonics.recplay.bb.a(bb.java:24)
 at com.softsynth.javasonics.recplay.tb.a(tb.java:830)
 at com.softsynth.javasonics.recplay.tb.run(tb.java:917)
 at java.lang.Thread.run(Thread.java:619)

Any suggestion?
Thanks!

Revision history for this message
manolo (manuel-sales) wrote :

I have Ubuntu 9.10 (the first time I try Ubuntu) and I have the same problem as pitx has described.

In my case I have a java application wrote by me and when other application is playing sound (for example Rhythmbox) when I execute my java application at the moment I try to get the line...
      clipConfCV = (Clip) AudioSystem.getLine(new DataLine.Info(Clip.class, sound.getFormat()));
...I got the LineUnavailableException

If I run my java application when no other application is playing sound, then no problem, java gets the line and plays the sound.

It is a pity because I was very happy with the idea of migrating from Vista to Ubuntu; but till this problem is solved I have no other choice than to go back to Vista.

Revision history for this message
Daniel T Chen (crimsun) wrote : Re: [Bug 209198] Re: Cannot play my music when watching playing java games

Does Java have support for ALSA in the JDK/JRE that you use? You should stop
using the OSS API if so.

You can also use padsp.

On Nov 5, 2009 9:01 PM, "manolo" <email address hidden> wrote:

*** This bug is a duplicate of bug 228487 ***
https://bugs.launchpad.net/bugs/228487
I have Ubuntu 9.10 (the first time I try Ubuntu) and I have the same
problem as pitx has described.

In my case I have a java application wrote by me and when other application
is playing sound (for example Rhythmbox) when I execute my java application
at the moment I try to get the line...
     clipConfCV = (Clip) AudioSystem.getLine(new DataLine.Info(Clip.class,
sound.getFormat()));
...I got the LineUnavailableException

If I run my java application when no other application is playing sound,
then no problem, java gets the line and plays the sound.

It is a pity because I was very happy with the idea of migrating from
Vista to Ubuntu; but till this problem is solved I have no other choice
than to go back to Vista.

-- Cannot play my music when watching playing java games
https://bugs.launchpad.net/bugs/209198...

Revision history for this message
manolo (manuel-sales) wrote :

Thanks Daniel, but still no improvement.

I'm not an expert but it seems that JRE/JDK uses OSS or ALSA OSS emulation instead of ALSA directly.

I have tried what you say padsp, but thinks work worse or just dont work.
For instance I have an applet that I execute with... java -jar "/home/manolo/NetBeansProjects/Utils/dist/Utils.jar"
and it sounds (as long as no other application is using the sound card)

If I run with padsp... padsp java -jar "/home/manolo/NetBeansProjects/Utils/dist/Utils.jar"
Then I hear only just a little burst
If instead of my applet I start firefox from the command line with... padsp firefox
the firefox doesnt even start (so no solution at all for web applets)

I tried also aoss but I have same effects.

This bug was first reported with Ubuntu 8.04 and with 9.10 stills goes on..
I dont know if there is a solution, but Sun and Canonical should work closer to integrate their products because not all the people has a soundcard with hardware mixing and those problems put the people back to Windows no matter how nice are the Ubuntu features.

Revision history for this message
deadalnix (deadalnix) wrote :

Got a java specific fix here : http://www.tuxyturvy.com/blog/index.php?/archives/66-Making-Sun-Java-1.6-play-via-PulseAudio.html

I put this here because the duplicated bug deos say anything about java.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.