Bug#567856: libbasicplayer-java: Fails with OpenJDK+PulseAudio
أحمد
أحمد
Sun Jan 31 20:19:41 UTC 2010
Package: libbasicplayer-java
Version: 3.0-3
Severity: normal
Tags: patch
Hello,
I use OpenJDK as the JRE, with PulseAudio as the sound service
provider. So, when I run a java app that uses libbasicplayer-java, I
get this exception:
java.lang.IllegalArgumentException: Master Gain not supported
org.classpath.icedtea.pulseaudio.PulseAudioLine.getControl(PulseAudioLine.java:89)
org.classpath.icedtea.pulseaudio.PulseAudioSourceDataLine.getControl(PulseAudioSourceDataLine.java:51)
javazoom.jlgui.basicplayer.BasicPlayer.openLine(Unknown Source)
So upstream of the app. directed me to[1], which suggests that the
problem is that OpenJDK throws an exception when 'isControlSupported'
is called. So I made a patch to workaround this problem, and it
worked. I am not good at java, and I understand from the chat I had on
#debian-java that I am not doing the 'catch' thing properly. But I
don't understand how to make it better, so I am submitting the patch
to you guys, hoping that you would make it better and apply it to
libbasicplayer-java.
[1] http://stackoverflow.com/questions/1914216/master-gain-not-supported-in-openjdk
-- System Information:
Debian Release: squeeze/sid
APT prefers karmic-updates
APT policy: (500, 'karmic-updates'), (500, 'karmic-security'), (500, 'karmic-proposed'), (500, 'karmic-backports'), (500, 'karmic')
Architecture: i386 (i686)
Kernel: Linux 2.6.31-18-generic (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libbasicplayer-java depends on:
ii default-jre [java2-r 1.6-30ubuntu5 Standard Java or Java compatible R
ii gcj-4.4-jre [java2-r 4.4.1-5ubuntu2 Java runtime environment using GIJ
ii gcj-jre [java2-runti 4:4.4.1-1ubuntu2 Java runtime environment using GIJ
ii openjdk-6-jre [java2 6b16-1.6.1-3ubuntu1 OpenJDK Java runtime, using Hotspo
libbasicplayer-java recommends no packages.
Versions of packages libbasicplayer-java suggests:
ii gcj-4.4-jre-headless [j 4.4.1-5ubuntu2 Java runtime environment using GIJ
ii gcj-jre-headless [java- 4:4.4.1-1ubuntu2 Java runtime environment using GIJ
-- debconf-show failed
-------------- next part --------------
Description: Workaround OpenJDK's Pulse Audio implementation
The pulse audio implementation in OpenJDK claims to support gain when you
call isControlSupported, but then throws an exception anyway. So put a try
catch around isControlSupported calls to avoid problems, please refer to:
http://stackoverflow.com/questions/1914216/master-gain-not-supported-in-openjdk
--- a/src/javazoom/jlgui/basicplayer/BasicPlayer.java
+++ b/src/javazoom/jlgui/basicplayer/BasicPlayer.java
@@ -454,17 +454,23 @@
log.debug("Controls : " + c[p].toString());
}
/*-- Is Gain Control supported ? --*/
- if (m_line.isControlSupported(FloatControl.Type.MASTER_GAIN))
- {
- m_gainControl = (FloatControl) m_line.getControl(FloatControl.Type.MASTER_GAIN);
- log.info("Master Gain Control : [" + m_gainControl.getMinimum() + "," + m_gainControl.getMaximum() + "] " + m_gainControl.getPrecision());
+ try {
+ if (m_line.isControlSupported(FloatControl.Type.MASTER_GAIN))
+ {
+ m_gainControl = (FloatControl) m_line.getControl(FloatControl.Type.MASTER_GAIN);
+ log.info("Master Gain Control : [" + m_gainControl.getMinimum() + "," + m_gainControl.getMaximum() + "] " + m_gainControl.getPrecision());
+ }
}
+ catch (Exception e) { }
/*-- Is Pan control supported ? --*/
- if (m_line.isControlSupported(FloatControl.Type.PAN))
- {
- m_panControl = (FloatControl) m_line.getControl(FloatControl.Type.PAN);
- log.info("Pan Control : [" + m_panControl.getMinimum() + "," + m_panControl.getMaximum() + "] " + m_panControl.getPrecision());
+ try {
+ if (m_line.isControlSupported(FloatControl.Type.PAN))
+ {
+ m_panControl = (FloatControl) m_line.getControl(FloatControl.Type.PAN);
+ log.info("Pan Control : [" + m_panControl.getMinimum() + "," + m_panControl.getMaximum() + "] " + m_panControl.getPrecision());
+ }
}
+ catch (Exception e) { }
}
}
@@ -795,7 +801,10 @@
if (m_gainControl == null)
{
// Try to get Gain control again (to support J2SE 1.5)
- if ( (m_line != null) && (m_line.isControlSupported(FloatControl.Type.MASTER_GAIN))) m_gainControl = (FloatControl) m_line.getControl(FloatControl.Type.MASTER_GAIN);
+ try {
+ if ( (m_line != null) && (m_line.isControlSupported(FloatControl.Type.MASTER_GAIN))) m_gainControl = (FloatControl) m_line.getControl(FloatControl.Type.MASTER_GAIN);
+ }
+ catch (Exception e) { }
}
return m_gainControl != null;
}
@@ -853,7 +862,10 @@
if (m_panControl == null)
{
// Try to get Pan control again (to support J2SE 1.5)
- if ((m_line != null)&& (m_line.isControlSupported(FloatControl.Type.PAN))) m_panControl = (FloatControl) m_line.getControl(FloatControl.Type.PAN);
+ try {
+ if ((m_line != null)&& (m_line.isControlSupported(FloatControl.Type.PAN))) m_panControl = (FloatControl) m_line.getControl(FloatControl.Type.PAN);
+ }
+ catch (Exception e) { }
}
return m_panControl != null;
}
More information about the pkg-java-maintainers
mailing list