Audio Player crashes on volume change

Bug #622663 reported by Ahmad Jawad
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zekr
New
Undecided
Unassigned

Bug Description

I use Ubuntu 10.04 and installed zekr from PPA. Whenever I change volume level from Audio Player Window after pressing play button, the volume level does not change and a Window popped with following error description:

-------------------------------
net.sf.zekr.engine.audio.PlayerException: javazoom.jlgui.basicplayer.BasicPlayerException: Gain control not supported
 at net.sf.zekr.engine.audio.DefaultPlayerController.setGain(DefaultPlayerController.java:187)
 at net.sf.zekr.engine.audio.DefaultPlayerController.setVolume(DefaultPlayerController.java:243)
 at net.sf.zekr.engine.audio.ui.AudioPlayerForm$14.mouseUp(AudioPlayerForm.java:553)
 at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:213)
 at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
 at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3552)
 at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3171)
 at net.sf.zekr.ui.BaseForm.loopEver(BaseForm.java:34)
 at net.sf.zekr.ZekrMain.startZekr(ZekrMain.java:63)
 at net.sf.zekr.ZekrMain.main(ZekrMain.java:91)
Caused by: javazoom.jlgui.basicplayer.BasicPlayerException: Gain control not supported
 at javazoom.jlgui.basicplayer.BasicPlayer.setGain(Unknown Source)
 at net.sf.zekr.engine.audio.DefaultPlayerController.setGain(DefaultPlayerController.java:185)
 ... 10 more
-------------------------------------------------------------

Revision history for this message
أحمد المحمودي (Ahmed El-Mahmoudy) (aelmahmoudy) wrote : Re: [Bug 622663] [NEW] Audio Player crashes on volume change

On Mon, Aug 23, 2010 at 11:41:08AM -0000, Ahmad Jawad wrote:
> Public bug reported:
>
> I use Ubuntu 10.04 and installed zekr from PPA. Whenever I change volume
> level from Audio Player Window after pressing play button, the volume
> level does not change and a Window popped with following error
> description:
>
> -------------------------------
> net.sf.zekr.engine.audio.PlayerException: javazoom.jlgui.basicplayer.BasicPlayerException: Gain control not supported
> at net.sf.zekr.engine.audio.DefaultPlayerController.setGain(DefaultPlayerController.java:187)
> at net.sf.zekr.engine.audio.DefaultPlayerController.setVolume(DefaultPlayerController.java:243)
> at net.sf.zekr.engine.audio.ui.AudioPlayerForm$14.mouseUp(AudioPlayerForm.java:553)
> at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:213)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3552)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3171)
> at net.sf.zekr.ui.BaseForm.loopEver(BaseForm.java:34)
> at net.sf.zekr.ZekrMain.startZekr(ZekrMain.java:63)
> at net.sf.zekr.ZekrMain.main(ZekrMain.java:91)
> Caused by: javazoom.jlgui.basicplayer.BasicPlayerException: Gain control not supported
> at javazoom.jlgui.basicplayer.BasicPlayer.setGain(Unknown Source)
> at net.sf.zekr.engine.audio.DefaultPlayerController.setGain(DefaultPlayerController.java:185)
> ... 10 more
> -------------------------------------------------------------
---end quoted text---

That's actually a bug in OpenJDK, that it does not support Gain control.
To get around this problem, use Sun Java JRE instead, and that is by
adding this line in ~/.zekr/zekrrc-debian:

ZEKR_JAVA_HOME=/usr/lib/jvm/java-6-sun

And of course you must have sun-java6-jre installed.

--
 ‎أحمد المحمودي (Ahmed El-Mahmoudy)
  Digital design engineer
 GPG KeyID: 0xEDDDA1B7
 GPG Fingerprint: 8206 A196 2084 7E6D 0DF8 B176 BC19 6A94 EDDD A1B7

Revision history for this message
Ahmad Jawad (ahmad-jawad) wrote :

You are right. I am not facing this problem with Sun Java 6. But my question is why it is using Openjdk in the first place because my alternatives setting is on Sun java and /usr/bin/java is also pointing towards Sun Java.

Revision history for this message
أحمد المحمودي (Ahmed El-Mahmoudy) (aelmahmoudy) wrote : Re: [Bug 622663] Re: Audio Player crashes on volume change

On Tue, Aug 24, 2010 at 07:26:07AM -0000, Ahmad Jawad wrote:
> You are right. I am not facing this problem with Sun Java 6. But my
> question is why it is using Openjdk in the first place because my
> alternatives setting is on Sun java and /usr/bin/java is also pointing
> towards Sun Java.
---end quoted text---

Good point, will try do something about that insh'Allah.

--
 ‎أحمد المحمودي (Ahmed El-Mahmoudy)
  Digital design engineer
 GPG KeyID: 0xEDDDA1B7
 GPG Fingerprint: 8206 A196 2084 7E6D 0DF8 B176 BC19 6A94 EDDD A1B7

Revision history for this message
Ahmad Jawad (ahmad-jawad) wrote :

Oh sorry, Sun Java is not playing Audio at all. I am getting the following error

14:17:48 [ERROR] (AudioPlayerUiController:123) - Error occured in play-pause method.
net.sf.zekr.engine.audio.PlayerException: javazoom.jlgui.basicplayer.BasicPlayerException: Cannot init line
 at net.sf.zekr.engine.audio.DefaultPlayerController.play(DefaultPlayerController.java:162)
 at net.sf.zekr.ui.AudioPlayerUiController.playerTogglePlayPause(AudioPlayerUiController.java:211)
 at net.sf.zekr.engine.audio.ui.AudioPlayerForm$8.widgetSelected(AudioPlayerForm.java:455)
 at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
 at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
 at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3552)
 at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3171)
 at net.sf.zekr.ui.BaseForm.loopEver(BaseForm.java:34)
 at net.sf.zekr.ZekrMain.startZekr(ZekrMain.java:63)
 at net.sf.zekr.ZekrMain.main(ZekrMain.java:91)
Caused by: javazoom.jlgui.basicplayer.BasicPlayerException: Cannot init line
 at javazoom.jlgui.basicplayer.BasicPlayer.startPlayback(Unknown Source)
 at javazoom.jlgui.basicplayer.BasicPlayer.play(Unknown Source)
 at net.sf.zekr.engine.audio.DefaultPlayerController.play(DefaultPlayerController.java:159)
 ... 10 more
Caused by: javax.sound.sampled.LineUnavailableException: Audio Device Unavailable
 at com.sun.media.sound.HeadspaceMixer.nResume(Native Method)
 at com.sun.media.sound.HeadspaceMixer.implOpen(HeadspaceMixer.java:346)
 at com.sun.media.sound.AbstractMixer.open(AbstractMixer.java:286)
 at com.sun.media.sound.AbstractMixer.open(AbstractMixer.java:323)
 at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:103)
 at com.sun.media.sound.MixerSourceLine.open(MixerSourceLine.java:39)
 at javazoom.jlgui.basicplayer.BasicPlayer.openLine(Unknown Source)
 at javazoom.jlgui.basicplayer.BasicPlayer.initLine(Unknown Source)
 ... 13 more

Revision history for this message
Mohsen Saboorian (mohsens) wrote :

This error happens when some other applications try to send data to audio adapter. You can find which application tries to gain this access by 1. start playing with Zekr, 2. close other applications one by one so that you find which one causes this issue.

This is actually an issue with Java Sound, which requires exclusive access to sound adapter. I'll investigate more about this issue.

Revision history for this message
Mohsen Saboorian (mohsens) wrote :

1. You should set your Java to Sun JRE (OpenJDK's audio support is too limited). This can be set globally using these instructions, or locally, by setting the following line in ~/.zekr/zekrrc-debian:
ZEKR_JAVA_HOME=/usr/lib/jvm/java-6-sun

If you do step one, you won't see any problem like:
java.lang.IllegalArgumentException: Master Gain not supported

2. After switching to Sun JRE, hanging problems or master gain problems will resolve. But as Java audio tries to get exclusive access to sound adapter, no other application can use sound adapter when Zekr is open. Otherwise you will see exceptions like this:
net.sf.zekr.engine.audio.PlayerException: javazoom.jlgui.basicplayer.BasicPlayerException: Cannot init line
...
Caused by: javax.sound.sampled.LineUnavailableException: Audio Device Unavailable

In order to workaround above issue, you should force Zekr (and Java) to use OSS interface (Open Sound System) and this can be achieved by wrapping Zekr with padsp. So open a console and write the following command to launch Zekr:
$ padsp zekr

This should resolve any sound-related issue for Zekr.
Please let me know if you still have problems with audio on Linux.

Mohsen

Revision history for this message
Ahmad Jawad (ahmad-jawad) wrote :

Yes, The issue is resolved following your instructions.

One suggestion: You can add padsp is .desktop file

Thanks for you help
Jazakallah

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.