< prev index next >

test/javax/sound/sampled/Clip/bug5070081.java

Print this page

        

*** 25,41 **** import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.DataLine; /* * @test * @bug 5070081 * @summary Tests that javax.sound.sampled.Clip does not loses position through * stop/start - * @key headful */ public class bug5070081 { static AudioFormat format = new AudioFormat(22050, 8, 1, false, false); // create a 3-second file --- 25,41 ---- import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.DataLine; + import javax.sound.sampled.LineUnavailableException; /* * @test * @bug 5070081 * @summary Tests that javax.sound.sampled.Clip does not loses position through * stop/start */ public class bug5070081 { static AudioFormat format = new AudioFormat(22050, 8, 1, false, false); // create a 3-second file
*** 43,56 **** static final int LOOP_COUNT = 5; static boolean test() throws Exception { DataLine.Info info = new DataLine.Info(Clip.class, format); ! Clip clip = (Clip)AudioSystem.getLine(info); ! clip.open(format, soundData, 0, soundData.length); ! boolean bSuccess = true; long nLengthMS = clip.getMicrosecondLength()/1000; System.out.println(" Clip length:"); System.out.println(" frames: " + clip.getFrameLength()); --- 43,61 ---- static final int LOOP_COUNT = 5; static boolean test() throws Exception { DataLine.Info info = new DataLine.Info(Clip.class, format); ! Clip clip = null; boolean bSuccess = true; + try { + clip = (Clip) AudioSystem.getLine(info); + clip.open(format, soundData, 0, soundData.length); + } catch (LineUnavailableException | IllegalArgumentException ignored) { + // the test is not applicable + return bSuccess; + } long nLengthMS = clip.getMicrosecondLength()/1000; System.out.println(" Clip length:"); System.out.println(" frames: " + clip.getFrameLength());
< prev index next >