-
Bug
-
Resolution: Cannot Reproduce
-
P1
-
OpenJDK6, 6u38
-
generic
-
linux_ubuntu
An attempt to open a SourceDataLine leads to LineUnavailableException if run with -Xfuture option.
=======================================8<==================================
package testapp.sound;
import java.io.File;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.SourceDataLine;
public class OpenSDLine {
public static void main(String[] args) {
OpenSDLine inst = new OpenSDLine();
try {
inst.m1(args);
} catch (Exception e) {
e.printStackTrace();
}
}
public void m1(String[] args) throws Exception {
String audioFile = args[0];
AudioInputStream ais =
AudioSystem.getAudioInputStream(new File(audioFile));
DataLine.Info lineInfo =
new DataLine.Info(SourceDataLine.class, ais.getFormat());
SourceDataLine sdLine = (SourceDataLine) AudioSystem.getLine(lineInfo);
sdLine.open();
sdLine.start();
byte[] buf = new byte[1024];
int bytesRead;
while ( (bytesRead = ais.read(buf)) != -1) {
sdLine.write(buf, 0, bytesRead);
}
sdLine.stop();
sdLine.close();
}
}
=======================================8<==================================
=======================================8<==================================
$ java -version
openjdk version "1.6.0-internal"
OpenJDK Runtime Environment (build 1.6.0-internal-dherron_19_dec_2007_13_45-b00)
Java HotSpot(TM) Client VM (build 11.0-b06, mixed mode)
$ java -Xfuture -cp . testapp.sound.OpenSDLine [VALID_SAMPLED_AUDIO_FILE]
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:344)
at com.sun.media.sound.AbstractMixer.open(AbstractMixer.java:304)
at com.sun.media.sound.AbstractMixer.open(AbstractMixer.java:341)
at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:121)
at com.sun.media.sound.MixerSourceLine.open(MixerSourceLine.java:37)
at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:417)
at com.sun.media.sound.MixerSourceLine.open(MixerSourceLine.java:37)
at testapp.sound.OpenSDLine.m1(OpenSDLine.java:28)
at testapp.sound.OpenSDLine.main(OpenSDLine.java:14)
=======================================8<==================================
If no -Xfuture option is provided, the code works fine.
=======================================8<==================================
package testapp.sound;
import java.io.File;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.SourceDataLine;
public class OpenSDLine {
public static void main(String[] args) {
OpenSDLine inst = new OpenSDLine();
try {
inst.m1(args);
} catch (Exception e) {
e.printStackTrace();
}
}
public void m1(String[] args) throws Exception {
String audioFile = args[0];
AudioInputStream ais =
AudioSystem.getAudioInputStream(new File(audioFile));
DataLine.Info lineInfo =
new DataLine.Info(SourceDataLine.class, ais.getFormat());
SourceDataLine sdLine = (SourceDataLine) AudioSystem.getLine(lineInfo);
sdLine.open();
sdLine.start();
byte[] buf = new byte[1024];
int bytesRead;
while ( (bytesRead = ais.read(buf)) != -1) {
sdLine.write(buf, 0, bytesRead);
}
sdLine.stop();
sdLine.close();
}
}
=======================================8<==================================
=======================================8<==================================
$ java -version
openjdk version "1.6.0-internal"
OpenJDK Runtime Environment (build 1.6.0-internal-dherron_19_dec_2007_13_45-b00)
Java HotSpot(TM) Client VM (build 11.0-b06, mixed mode)
$ java -Xfuture -cp . testapp.sound.OpenSDLine [VALID_SAMPLED_AUDIO_FILE]
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:344)
at com.sun.media.sound.AbstractMixer.open(AbstractMixer.java:304)
at com.sun.media.sound.AbstractMixer.open(AbstractMixer.java:341)
at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:121)
at com.sun.media.sound.MixerSourceLine.open(MixerSourceLine.java:37)
at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:417)
at com.sun.media.sound.MixerSourceLine.open(MixerSourceLine.java:37)
at testapp.sound.OpenSDLine.m1(OpenSDLine.java:28)
at testapp.sound.OpenSDLine.main(OpenSDLine.java:14)
=======================================8<==================================
If no -Xfuture option is provided, the code works fine.
- duplicates
-
JDK-6658094 An attempt to open a synthesizer leads to MidiUnavailableException if run with -Xfuture option.
-
- Closed
-
-
JDK-6660712 JCK 6a test api/javax_sound/interactive/PlaySoundTest.html#PlaySoundTest fails on Ubuntu
-
- Closed
-
-
JDK-6669344 JCK 6a test api/javax_sound/interactive/PlayMidiTests.html#PlayMidiTest fails on Ubuntu
-
- Closed
-
- relates to
-
JDK-6658097 An attempt to get a sequencer leads to MidiUnavailableException if run with -Xfuture
-
- Closed
-
-
JDK-4937708 AudioFormat.matches should allow NOT_SPECIFY in all fields
-
- Closed
-