From i30817 at gmail.com Tue Mar 23 22:55:07 2010 From: i30817 at gmail.com (Paulo Levi) Date: Wed, 24 Mar 2010 05:55:07 +0000 Subject: Line unavailable exceptions still happening with openjdk when acquiring a sourcedataline Message-ID: <212322091003232255t13b4a22aic823bf7ecd5be1f@mail.gmail.com> This still happens on ubuntu lucid lynx with a recent jdk java version "1.7.0_0-icedtea" OpenJDK Runtime Environment (IcedTea7 1.11) (7b72-0ubuntu1~ppa1) OpenJDK Client VM (build 17.0-b01, mixed mode, sharing) in the third post in this thread http://forums.sun.com/thread.jspa?threadID=5189363 Don't you guys test sound in linux :( -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/sound-dev/attachments/20100324/07c65bd1/attachment.html From i30817 at gmail.com Tue Mar 23 22:56:17 2010 From: i30817 at gmail.com (Paulo Levi) Date: Wed, 24 Mar 2010 05:56:17 +0000 Subject: Line unavailable exceptions still happening with openjdk when acquiring a sourcedataline In-Reply-To: <212322091003232255t13b4a22aic823bf7ecd5be1f@mail.gmail.com> References: <212322091003232255t13b4a22aic823bf7ecd5be1f@mail.gmail.com> Message-ID: <212322091003232256r38394741j40a0f0ab3476203b@mail.gmail.com> Forgot this is when using freetts, but really i expect it to happen with other programs. On Wed, Mar 24, 2010 at 5:55 AM, Paulo Levi wrote: > This still happens on ubuntu lucid lynx with a recent jdk > java version "1.7.0_0-icedtea" > OpenJDK Runtime Environment (IcedTea7 1.11) (7b72-0ubuntu1~ppa1) > OpenJDK Client VM (build 17.0-b01, mixed mode, sharing) > > in the third post in this thread > http://forums.sun.com/thread.jspa?threadID=5189363 > > Don't you guys test sound in linux :( > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/sound-dev/attachments/20100324/ce0d8d5d/attachment.html From i30817 at gmail.com Tue Mar 23 23:50:49 2010 From: i30817 at gmail.com (Paulo Levi) Date: Wed, 24 Mar 2010 06:50:49 +0000 Subject: Line unavailable exceptions still happening with openjdk when acquiring a sourcedataline In-Reply-To: <212322091003232256r38394741j40a0f0ab3476203b@mail.gmail.com> References: <212322091003232255t13b4a22aic823bf7ecd5be1f@mail.gmail.com> <212322091003232256r38394741j40a0f0ab3476203b@mail.gmail.com> Message-ID: <212322091003232350k4ee8e577nc535700a08c386c7@mail.gmail.com> Here is a testcase. Hope this can be fixed: package util.speech; import java.util.Iterator; import java.util.Locale; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.Mixer; import javax.sound.sampled.SourceDataLine; import org.junit.After; import org.junit.AfterClass; import org.junit.Assume; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; /** * * @author i30817 */ public class VoiceTest { public VoiceTest() { } @BeforeClass public static void setUpClass() throws Exception { } @AfterClass public static void tearDownClass() throws Exception { } @Before public void setUp() { } @After public void tearDown() { } @Test public void testDataLineAvailableAndBuggyInJDK() throws LineUnavailableException { boolean failedSimpleGetLine = false; AudioFormat format = new AudioFormat(44100, 16, 2, true, false); SourceDataLine line = null; DataLine.Info info = new DataLine.Info(SourceDataLine.class, format); try { line = (SourceDataLine) AudioSystem.getLine(info); } catch (LineUnavailableException e) { //ok, at least it says so throw e; } try { //if this fails the jdk is very buggy, since it just told us //the line was available line.open(format); } catch (LineUnavailableException e) { failedSimpleGetLine = true; } finally { if (line.isOpen()) { line.close(); } } //now if this is true, test if it's possible to get a valid sourcedataline //or the only bug is adquiring a sourcedataline doesn't throw a lineunavailable //exception before open Assume.assumeTrue(failedSimpleGetLine); line = getSourceDataLine(format); if (line == null) { return; } try { line.open(format); } catch (LineUnavailableException e) { //ok then it is consistent, and there is only one bug fail("Line Unavailable after being adquired"); } finally { if (line.isOpen()) { line.close(); } } fail("line available after first test not managing to adquire it"); } private SourceDataLine getSourceDataLine(AudioFormat format) { try { DataLine.Info info = new DataLine.Info(SourceDataLine.class, format); for (Mixer.Info mi : AudioSystem.getMixerInfo()) { SourceDataLine dataline = null; try { Mixer mixer = AudioSystem.getMixer(mi); dataline = (SourceDataLine) mixer.getLine(info); dataline.open(format); dataline.start(); return dataline; } catch (Exception e) { } if (dataline != null) { try { dataline.close(); } catch (Exception e) { } } } } catch (Exception e) { } return null; } } On Wed, Mar 24, 2010 at 5:56 AM, Paulo Levi wrote: > Forgot this is when using freetts, but really i expect it to happen with > other programs. > > > On Wed, Mar 24, 2010 at 5:55 AM, Paulo Levi wrote: > >> This still happens on ubuntu lucid lynx with a recent jdk >> java version "1.7.0_0-icedtea" >> OpenJDK Runtime Environment (IcedTea7 1.11) (7b72-0ubuntu1~ppa1) >> OpenJDK Client VM (build 17.0-b01, mixed mode, sharing) >> >> in the third post in this thread >> http://forums.sun.com/thread.jspa?threadID=5189363 >> >> Don't you guys test sound in linux :( >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/sound-dev/attachments/20100324/c7127a57/attachment.html From bob.lang at blueyonder.co.uk Wed Mar 24 02:05:51 2010 From: bob.lang at blueyonder.co.uk (Bob Lang) Date: Wed, 24 Mar 2010 09:05:51 +0000 Subject: Line unavailable exceptions still happening with openjdk when acquiring a sourcedataline In-Reply-To: <212322091003232350k4ee8e577nc535700a08c386c7@mail.gmail.com> References: <212322091003232255t13b4a22aic823bf7ecd5be1f@mail.gmail.com> <212322091003232256r38394741j40a0f0ab3476203b@mail.gmail.com> <212322091003232350k4ee8e577nc535700a08c386c7@mail.gmail.com> Message-ID: <1EF68E6E-C3C4-4C70-8F48-7D00D37BF7FE@blueyonder.co.uk> What happens if you attempt to get a SourceDataLine like this? AudioFormat audioFormat = new AudioFormat (...); SourceDataLine sdl = AudioSystem.getSourceDataLine (audioFormat); The above inside a try/catch of course.. Bob -- On 24 Mar 2010, at 06:50, Paulo Levi wrote: > Here is a testcase. Hope this can be fixed: > > package util.speech; > > import java.util.Iterator; > import java.util.Locale; > import javax.sound.sampled.AudioFormat; > import javax.sound.sampled.AudioSystem; > import javax.sound.sampled.DataLine; > import javax.sound.sampled.LineUnavailableException; > import javax.sound.sampled.Mixer; > import javax.sound.sampled.SourceDataLine; > import org.junit.After; > import org.junit.AfterClass; > import org.junit.Assume; > import org.junit.Before; > import org.junit.BeforeClass; > import org.junit.Test; > import static org.junit.Assert.*; > > /** > * > * @author i30817 > */ > public class VoiceTest { > > > > public VoiceTest() { > } > > @BeforeClass > public static void setUpClass() throws Exception { > } > > @AfterClass > public static void tearDownClass() throws Exception { > } > > @Before > public void setUp() { > > } > > @After > public void tearDown() { > } > > @Test > public void testDataLineAvailableAndBuggyInJDK() throws LineUnavailableException { > boolean failedSimpleGetLine = false; > AudioFormat format = new AudioFormat(44100, 16, 2, true, false); > SourceDataLine line = null; > DataLine.Info info = new DataLine.Info(SourceDataLine.class, format); > try { > line = (SourceDataLine) AudioSystem.getLine(info); > } catch (LineUnavailableException e) { > //ok, at least it says so > throw e; > } > try { > //if this fails the jdk is very buggy, since it just told us > //the line was available > line.open(format); > } catch (LineUnavailableException e) { > failedSimpleGetLine = true; > } finally { > if (line.isOpen()) { > line.close(); > } > } > > > > //now if this is true, test if it's possible to get a valid sourcedataline > //or the only bug is adquiring a sourcedataline doesn't throw a lineunavailable > //exception before open > Assume.assumeTrue(failedSimpleGetLine); > line = getSourceDataLine(format); > if (line == null) { > return; > } > > try { > line.open(format); > } catch (LineUnavailableException e) { > //ok then it is consistent, and there is only one bug > fail("Line Unavailable after being adquired"); > } finally { > if (line.isOpen()) { > line.close(); > } > } > fail("line available after first test not managing to adquire it"); > } > > > private SourceDataLine getSourceDataLine(AudioFormat format) { > try { > DataLine.Info info = new DataLine.Info(SourceDataLine.class, format); > for (Mixer.Info mi : AudioSystem.getMixerInfo()) { > SourceDataLine dataline = null; > try { > Mixer mixer = AudioSystem.getMixer(mi); > dataline = (SourceDataLine) mixer.getLine(info); > dataline.open(format); > dataline.start(); > return dataline; > } catch (Exception e) { > } > if (dataline != null) { > try { > dataline.close(); > } catch (Exception e) { > } > } > } > } catch (Exception e) { > } > return null; > } > } > > > > On Wed, Mar 24, 2010 at 5:56 AM, Paulo Levi wrote: > Forgot this is when using freetts, but really i expect it to happen with other programs. > > > On Wed, Mar 24, 2010 at 5:55 AM, Paulo Levi wrote: > This still happens on ubuntu lucid lynx with a recent jdk > java version "1.7.0_0-icedtea" > OpenJDK Runtime Environment (IcedTea7 1.11) (7b72-0ubuntu1~ppa1) > OpenJDK Client VM (build 17.0-b01, mixed mode, sharing) > > in the third post in this thread > http://forums.sun.com/thread.jspa?threadID=5189363 > > Don't you guys test sound in linux :( > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/sound-dev/attachments/20100324/996cdf2b/attachment-0001.html From i30817 at gmail.com Wed Mar 24 09:28:16 2010 From: i30817 at gmail.com (Paulo Levi) Date: Wed, 24 Mar 2010 16:28:16 +0000 Subject: Line unavailable exceptions still happening with openjdk when acquiring a sourcedataline In-Reply-To: <1EF68E6E-C3C4-4C70-8F48-7D00D37BF7FE@blueyonder.co.uk> References: <212322091003232255t13b4a22aic823bf7ecd5be1f@mail.gmail.com> <212322091003232256r38394741j40a0f0ab3476203b@mail.gmail.com> <212322091003232350k4ee8e577nc535700a08c386c7@mail.gmail.com> <1EF68E6E-C3C4-4C70-8F48-7D00D37BF7FE@blueyonder.co.uk> Message-ID: <212322091003240928j35d3c9bdv8b5e84427e65586d@mail.gmail.com> Doesn't appear to make a difference. replaced the first lines by this: boolean failedSimpleGetLine = false; AudioFormat format = new AudioFormat(44100, 16, 2, true, false); SourceDataLine line = null; // DataLine.Info info = new DataLine.Info(SourceDataLine.class, format); try { line = (SourceDataLine) AudioSystem.getSourceDataLine(format); It still fails at the last line (reaches the last line). To clarify the bugs: 1) first it gives a sourcedataline that says it obeys the format, without throwing lineunavailableexception 2) first bug : then it throws lineunavailableexception when trying to open it. 3) second bug : however trying the sourcedatalines returned for all mixers eventually finds a line that just works - if so why wasn't that the line returned. The saddest thing is that i have pulseaudio installed and a recent version of openjdk installed. I assumed that was enough to get transparent mixing, so i removed my special fork of freetts. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/sound-dev/attachments/20100324/620232d2/attachment.html