< prev index next >

test/javax/sound/midi/Sequencer/SeqRecordsRealTimeEvents.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 22,47 **** */ import javax.sound.midi.MidiEvent; import javax.sound.midi.MidiMessage; import javax.sound.midi.MidiSystem; import javax.sound.midi.Receiver; import javax.sound.midi.Sequence; import javax.sound.midi.Sequencer; import javax.sound.midi.ShortMessage; import javax.sound.midi.Track; /** * @test * @bug 5048381 * @summary Sequencer records real time messages into the sequence - * @key headful */ public class SeqRecordsRealTimeEvents { ! public static void main(String argv[]) throws Exception { ! Sequencer s = MidiSystem.getSequencer(); s.open(); try { Sequence seq = new Sequence(Sequence.PPQ, 384, 2); s.setSequence(seq); Track t = seq.getTracks()[0]; ShortMessage msg = new ShortMessage(); --- 22,54 ---- */ import javax.sound.midi.MidiEvent; import javax.sound.midi.MidiMessage; import javax.sound.midi.MidiSystem; + import javax.sound.midi.MidiUnavailableException; import javax.sound.midi.Receiver; import javax.sound.midi.Sequence; import javax.sound.midi.Sequencer; import javax.sound.midi.ShortMessage; import javax.sound.midi.Track; /** * @test * @bug 5048381 * @summary Sequencer records real time messages into the sequence */ public class SeqRecordsRealTimeEvents { ! ! public static void main(String argv[]) { ! Sequencer s = null; ! try { ! s = MidiSystem.getSequencer(); s.open(); + } catch (final MidiUnavailableException ignored) { + // the test is not applicable + return; + } try { Sequence seq = new Sequence(Sequence.PPQ, 384, 2); s.setSequence(seq); Track t = seq.getTracks()[0]; ShortMessage msg = new ShortMessage();
*** 88,98 **** } System.out.println("Test passed."); } catch (Exception e) { System.out.println("Unexpected Exception: "+e); //e.printStackTrace(); ! throw new Exception("Test FAILED!"); } finally { s.close(); } } public static void printEvent(MidiEvent event) --- 95,105 ---- } System.out.println("Test passed."); } catch (Exception e) { System.out.println("Unexpected Exception: "+e); //e.printStackTrace(); ! throw new RuntimeException("Test FAILED!"); } finally { s.close(); } } public static void printEvent(MidiEvent event)
< prev index next >