Java Code Examples for javax.sound.midi.MidiDevice#isOpen()
The following examples show how to use
javax.sound.midi.MidiDevice#isOpen() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SequencerImplicitSynthOpen.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
static boolean test(Sequencer sequencer) throws MidiUnavailableException { log(""); log("opening sequencer..."); sequencer.open(); // opens connected synthesizer implicitly MidiDevice synth = getConnectedDevice(sequencer); log(" connected device: " + getDeviceStr(synth)); log("closing sequencer..."); sequencer.close(); // closes the synth implicitly log(" synth is " + getDeviceStr(synth)); MidiDevice synth2 = getConnectedDevice(sequencer); log(" currently connected device: " + getDeviceStr(synth2)); if (synth != null && synth.isOpen()) { log("FAIL."); return false; } log("OK."); return true; }
Example 2
Source File: SequencerImplicitSynthOpen.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
static boolean test(Sequencer sequencer) throws MidiUnavailableException { log(""); log("opening sequencer..."); sequencer.open(); // opens connected synthesizer implicitly MidiDevice synth = getConnectedDevice(sequencer); log(" connected device: " + getDeviceStr(synth)); log("closing sequencer..."); sequencer.close(); // closes the synth implicitly log(" synth is " + getDeviceStr(synth)); MidiDevice synth2 = getConnectedDevice(sequencer); log(" currently connected device: " + getDeviceStr(synth2)); if (synth != null && synth.isOpen()) { log("FAIL."); return false; } log("OK."); return true; }
Example 3
Source File: SequencerImplicitSynthOpen.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
static boolean test(Sequencer sequencer) throws MidiUnavailableException { log(""); log("opening sequencer..."); sequencer.open(); // opens connected synthesizer implicitly MidiDevice synth = getConnectedDevice(sequencer); log(" connected device: " + getDeviceStr(synth)); log("closing sequencer..."); sequencer.close(); // closes the synth implicitly log(" synth is " + getDeviceStr(synth)); MidiDevice synth2 = getConnectedDevice(sequencer); log(" currently connected device: " + getDeviceStr(synth2)); if (synth != null && synth.isOpen()) { log("FAIL."); return false; } log("OK."); return true; }
Example 4
Source File: SequencerImplicitSynthOpen.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
static boolean test(Sequencer sequencer) throws MidiUnavailableException { log(""); log("opening sequencer..."); sequencer.open(); // opens connected synthesizer implicitly MidiDevice synth = getConnectedDevice(sequencer); log(" connected device: " + getDeviceStr(synth)); log("closing sequencer..."); sequencer.close(); // closes the synth implicitly log(" synth is " + getDeviceStr(synth)); MidiDevice synth2 = getConnectedDevice(sequencer); log(" currently connected device: " + getDeviceStr(synth2)); if (synth != null && synth.isOpen()) { log("FAIL."); return false; } log("OK."); return true; }
Example 5
Source File: SequencerImplicitSynthOpen.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
static boolean test(Sequencer sequencer) throws MidiUnavailableException { log(""); log("opening sequencer..."); sequencer.open(); // opens connected synthesizer implicitly MidiDevice synth = getConnectedDevice(sequencer); log(" connected device: " + getDeviceStr(synth)); log("closing sequencer..."); sequencer.close(); // closes the synth implicitly log(" synth is " + getDeviceStr(synth)); MidiDevice synth2 = getConnectedDevice(sequencer); log(" currently connected device: " + getDeviceStr(synth2)); if (synth != null && synth.isOpen()) { log("FAIL."); return false; } log("OK."); return true; }
Example 6
Source File: SequencerImplicitSynthOpen.java From hottub with GNU General Public License v2.0 | 6 votes |
static boolean test(Sequencer sequencer) throws MidiUnavailableException { log(""); log("opening sequencer..."); sequencer.open(); // opens connected synthesizer implicitly MidiDevice synth = getConnectedDevice(sequencer); log(" connected device: " + getDeviceStr(synth)); log("closing sequencer..."); sequencer.close(); // closes the synth implicitly log(" synth is " + getDeviceStr(synth)); MidiDevice synth2 = getConnectedDevice(sequencer); log(" currently connected device: " + getDeviceStr(synth2)); if (synth != null && synth.isOpen()) { log("FAIL."); return false; } log("OK."); return true; }
Example 7
Source File: SequencerImplicitSynthOpen.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
static boolean test(Sequencer sequencer) throws MidiUnavailableException { log(""); log("opening sequencer..."); sequencer.open(); // opens connected synthesizer implicitly MidiDevice synth = getConnectedDevice(sequencer); log(" connected device: " + getDeviceStr(synth)); log("closing sequencer..."); sequencer.close(); // closes the synth implicitly log(" synth is " + getDeviceStr(synth)); MidiDevice synth2 = getConnectedDevice(sequencer); log(" currently connected device: " + getDeviceStr(synth2)); if (synth != null && synth.isOpen()) { log("FAIL."); return false; } log("OK."); return true; }
Example 8
Source File: SequencerImplicitSynthOpen.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
static boolean test(Sequencer sequencer) throws MidiUnavailableException { log(""); log("opening sequencer..."); sequencer.open(); // opens connected synthesizer implicitly MidiDevice synth = getConnectedDevice(sequencer); log(" connected device: " + getDeviceStr(synth)); log("closing sequencer..."); sequencer.close(); // closes the synth implicitly log(" synth is " + getDeviceStr(synth)); MidiDevice synth2 = getConnectedDevice(sequencer); log(" currently connected device: " + getDeviceStr(synth2)); if (synth != null && synth.isOpen()) { log("FAIL."); return false; } log("OK."); return true; }
Example 9
Source File: bug6186488.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { MidiDevice/*Synthesizer*/ synth = null; try { synth = MidiSystem.getSynthesizer(); //synth = MidiSystem.getMidiDevice(infos[0]); System.out.println("Synthesizer: " + synth.getDeviceInfo()); synth.open(); MidiMessage msg = new GenericMidiMessage(0x90, 0x3C, 0x40); //ShortMessage msg = new ShortMessage(); //msg.setMessage(0x90, 0x3C, 0x40); synth.getReceiver().send(msg, 0); Thread.sleep(2000); } catch (Exception ex) { ex.printStackTrace(); throw ex; } finally { if (synth != null && synth.isOpen()) synth.close(); } System.out.print("Did you heard a note? (enter 'y' or 'n') "); int result = System.in.read(); System.in.skip(1000); if (result == 'y' || result == 'Y') { System.out.println("Test passed sucessfully."); } else { System.out.println("Test FAILED."); throw new RuntimeException("Test failed."); } }
Example 10
Source File: SequencerImplicitSynthOpen.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
static boolean test(Sequencer sequencer) throws MidiUnavailableException { log(""); log("opening sequencer..."); sequencer.open(); // opens connected synthesizer implicitly MidiDevice synth = getConnectedDevice(sequencer); log(" connected device: " + getDeviceStr(synth)); log("closing sequencer..."); sequencer.close(); // closes the synth implicitly log(" synth is " + getDeviceStr(synth)); MidiDevice synth2 = getConnectedDevice(sequencer); log(" currently connected device: " + getDeviceStr(synth2)); if (synth != null && synth.isOpen()) { log("FAIL."); return false; } log("OK."); return true; }
Example 11
Source File: SequencerImplicitSynthOpen.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
static boolean test(Sequencer sequencer) throws MidiUnavailableException { log(""); log("opening sequencer..."); sequencer.open(); // opens connected synthesizer implicitly MidiDevice synth = getConnectedDevice(sequencer); log(" connected device: " + getDeviceStr(synth)); log("closing sequencer..."); sequencer.close(); // closes the synth implicitly log(" synth is " + getDeviceStr(synth)); MidiDevice synth2 = getConnectedDevice(sequencer); log(" currently connected device: " + getDeviceStr(synth2)); if (synth != null && synth.isOpen()) { log("FAIL."); return false; } log("OK."); return true; }
Example 12
Source File: SequencerImplicitSynthOpen.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
static boolean test(Sequencer sequencer) throws MidiUnavailableException { log(""); log("opening sequencer..."); sequencer.open(); // opens connected synthesizer implicitly MidiDevice synth = getConnectedDevice(sequencer); log(" connected device: " + getDeviceStr(synth)); log("closing sequencer..."); sequencer.close(); // closes the synth implicitly log(" synth is " + getDeviceStr(synth)); MidiDevice synth2 = getConnectedDevice(sequencer); log(" currently connected device: " + getDeviceStr(synth2)); if (synth != null && synth.isOpen()) { log("FAIL."); return false; } log("OK."); return true; }
Example 13
Source File: SequencerImplicitSynthOpen.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
static String getDeviceStr(MidiDevice dev) { if (dev == null) { return "NULL"; } return getClassStr(dev) + ", " + (dev.isOpen() ? "OPENED" : "CLOSED"); }
Example 14
Source File: SequencerImplicitSynthOpen.java From hottub with GNU General Public License v2.0 | 4 votes |
static String getDeviceStr(MidiDevice dev) { if (dev == null) { return "NULL"; } return getClassStr(dev) + ", " + (dev.isOpen() ? "OPENED" : "CLOSED"); }
Example 15
Source File: SequencerImplicitSynthOpen.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
static String getDeviceStr(MidiDevice dev) { if (dev == null) { return "NULL"; } return getClassStr(dev) + ", " + (dev.isOpen() ? "OPENED" : "CLOSED"); }
Example 16
Source File: SequencerImplicitSynthOpen.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
static String getDeviceStr(MidiDevice dev) { if (dev == null) { return "NULL"; } return getClassStr(dev) + ", " + (dev.isOpen() ? "OPENED" : "CLOSED"); }
Example 17
Source File: SequencerImplicitSynthOpen.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
static String getDeviceStr(MidiDevice dev) { if (dev == null) { return "NULL"; } return getClassStr(dev) + ", " + (dev.isOpen() ? "OPENED" : "CLOSED"); }
Example 18
Source File: SequencerImplicitSynthOpen.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
static String getDeviceStr(MidiDevice dev) { if (dev == null) { return "NULL"; } return getClassStr(dev) + ", " + (dev.isOpen() ? "OPENED" : "CLOSED"); }
Example 19
Source File: SequencerImplicitSynthOpen.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
static String getDeviceStr(MidiDevice dev) { if (dev == null) { return "NULL"; } return getClassStr(dev) + ", " + (dev.isOpen() ? "OPENED" : "CLOSED"); }
Example 20
Source File: SequencerImplicitSynthOpen.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
static String getDeviceStr(MidiDevice dev) { if (dev == null) { return "NULL"; } return getClassStr(dev) + ", " + (dev.isOpen() ? "OPENED" : "CLOSED"); }