/*
* @(#)MidiDevice.java 1.39 05/11/17
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package javax.sound.midi;
import java.util.List;
/**
* <code>MidiDevice</code> is the base interface for all MIDI devices.
* Common devices include synthesizers, sequencers, MIDI input ports, and MIDI
* output ports.
*
* <p>A <code>MidiDevice</code> can be a transmitter or a receiver of
* MIDI events, or both. Therefore, it can provide {@link Transmitter}
* or {@link Receiver} instances (or both). Typically, MIDI IN ports
* provide transmitters, MIDI OUT ports and synthesizers provide
* receivers. A Sequencer typically provides transmitters for playback
* and receivers for recording.
*
* <p>A <code>MidiDevice</code> can be opened and closed explicitly as
* well as implicitly. Explicit opening is accomplished by calling
* {@link #open}, explicit closing is done by calling {@link
* #close} on the <code>MidiDevice</code> instance.
* If an application opens a <code>MidiDevice</code>
* explicitly, it has to close it explicitly to free system resources
* and enable the application to exit cleanly. Implicit opening is
* done by calling {@link javax.sound.midi.MidiSystem#getReceiver
* MidiSystem.getReceiver} and {@link
* javax.sound.midi.MidiSystem#getTransmitter
* MidiSystem.getTransmitter}. The <code>MidiDevice</code> used by
* <code>MidiSystem.getReceiver</code> and
* <code>MidiSystem.getTransmitter</code> is implementation-dependant
* unless the properties <code>javax.sound.midi.Receiver</code>
* and <code>javax.sound.midi.Transmitter</code> are used (see the
* description of properties to select default providers in
* {@link javax.sound.midi.MidiSystem}). A <code>MidiDevice</code>
* that was opened implicitly, is closed implicitly by closing the
* <code>Receiver</code> or <code>Transmitter</code> that resulted in
* opening it. If more than one implicitly opening
* <code>Receiver</code> or <code>Transmitter</code> were obtained by
* the application, the decive is closed after the last
* <code>Receiver</code> or <code>Transmitter</code> has been
* closed. On the other hand, calling <code>getReceiver</code> or
* <code>getTransmitter</code> on the device instance directly does
* not open the device implicitly. Closing these
* <code>Transmitter</code>s and <code>Receiver</code>s does not close
* the device implicitly. To use a device with <code>Receiver</code>s
* or <code>Transmitter</code>s obtained this way, the device has to
* be opened and closed explicitly.
*
* <p>If implicit and explicit opening and closing are mixed on the
* same <code>MidiDevice</code> instance, the following rules apply:
*
* <ul>
* <li>After an explicit open (either before or after implicit
* opens), the device will not be closed by implicit closing. The only
* way to close an explicitly opened device is an explicit close.</li>
*
* <li>An explicit close always closes the device, even if it also has
* been opened implicitly. A subsequent implicit close has no further
* effect.</li>
* </ul>
*
* To detect if a MidiDevice represents a hardware MIDI port, the
* following programming technique can be used:
*
* <pre>
* MidiDevice device = ...;
* if ( ! (device instanceof Sequencer) && ! (device instanceof Synthesizer)) {
* // we're now sure that device represents a MIDI port
* // ...
* }
* </pre>
*
* <p>
* A <code>MidiDevice</code> includes a <code>{@link MidiDevice.Info}</code> object
* to provide manufacturer information and so on.
*
* @see Synthesizer
* @see Sequencer
* @see Receiver
* @see Transmitter
*
* @version 1.39, 05/11/17
* @author Kara Kytle
* @author Florian Bomers
*/
public interface MidiDevice {
/**
* Obtains information about the device, including its Java class and
* <code>Strings</code> containing its name, vendor, and description.
*
* @return device info
=1= |