Example usage for javax.sound.midi MidiDevice isOpen

List of usage examples for javax.sound.midi MidiDevice isOpen

Introduction

In this page you can find the example usage for javax.sound.midi MidiDevice isOpen.

Prototype

boolean isOpen();

Source Link

Document

Reports whether the device is open.

Usage

From source file:de.ailis.midi4js.Midi4JS.java

/**
 * Checks if the specified MIDI device is open.
 *
 * @param deviceHandle//from  w  w w  .j  a va 2  s  .  c o  m
 *            The device handle.
 * @return True if device is, open false if not.
 */
public boolean isMidiDeviceOpen(final int deviceHandle) {
    final MidiDevice device = resolveDeviceHandle(deviceHandle);
    return device.isOpen();
}

From source file:de.ailis.midi4js.Midi4JS.java

/**
 * @see java.applet.Applet#stop()/* w w w.  j  a  va  2s . c  o  m*/
 */
@Override
public void stop() {
    for (final Receiver receiver : this.receiverMap.values())
        receiver.close();
    for (final Transmitter transmitter : this.transmitterMap.values())
        transmitter.close();
    for (final MidiDevice device : this.deviceMap.values())
        if (device.isOpen())
            device.close();
    this.deviceMap = null;
    this.receiverMap = null;
    this.transmitterMap = null;
    System.out.println("Stopped midi4js applet (Instance #" + System.identityHashCode(this) + ")");
}