Example usage for javax.sound.midi MidiDevice getTransmitters

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

Introduction

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

Prototype

List<Transmitter> getTransmitters();

Source Link

Document

Returns all currently active, non-closed transmitters connected with this MidiDevice .

Usage

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

/**
 * Returns all currently open transmitters.
 *
 * @param deviceHandle//from  w  w  w .j  a va2  s.c  o  m
 *            The device handle.
 * @return All currently open transmitters in form of a JSON-encoded string
 *         which describes an array of transmitter handles.
 * @throws JSONException
 *             When JSON data could not be constructed.
 */
public String getTransmitters(final int deviceHandle) throws JSONException {
    final MidiDevice device = resolveDeviceHandle(deviceHandle);
    final JSONStringer json = new JSONStringer();
    json.array();
    for (final Transmitter transmitter : device.getTransmitters()) {
        json.value(System.identityHashCode(transmitter));
    }
    json.endArray();
    return json.toString();
}