/*
* @(#)MidiSystem.java 1.68 06/05/02
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package javax.sound.midi;
import java.io.FileInputStream;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.net.URL;
import javax.sound.midi.spi.MidiFileWriter;
import javax.sound.midi.spi.MidiFileReader;
import javax.sound.midi.spi.SoundbankReader;
import javax.sound.midi.spi.MidiDeviceProvider;
import com.sun.media.sound.JDK13Services;
import com.sun.media.sound.ReferenceCountingDevice;
import com.sun.media.sound.AutoConnectSequencer;
/**
* The <code>MidiSystem</code> class provides access to the installed MIDI
* system resources, including devices such as synthesizers, sequencers, and
* MIDI input and output ports. A typical simple MIDI application might
* begin by invoking one or more <code>MidiSystem</code> methods to learn
* what devices are installed and to obtain the ones needed in that
* application.
* <p>
* The class also has methods for reading files, streams, and URLs that
* contain standard MIDI file data or soundbanks. You can query the
* <code>MidiSystem</code> for the format of a specified MIDI file.
* <p>
* You cannot instantiate a <code>MidiSystem</code>; all the methods are
* static.
*
* <p>Properties can be used to specify default MIDI devices.
* Both system properties and a properties file are considered.
* The properties file is "lib/sound.properties" in the JRE
* directory. If a property exists both as a system property and in the
* properties file, the system property takes precedence. If none is
* specified, a suitable default is chosen among the available devices.
* The syntax of the properties file is specified in
* {@link java.util.Properties#load(InputStream) Properties.load}. The
* following table lists the available property keys and which methods
* consider them:
*
* <table border=0>
* <tr>
* <th>Property Key</th>
* <th>Interface</th>
* <th>Affected Method</th>
* </tr>
* <tr>
* <td><code>javax.sound.midi.Receiver</code></td>
* <td>{@link Receiver}</td>
* <td>{@link #getReceiver}</td>
* </tr>
* <tr>
* <td><code>javax.sound.midi.Sequencer</code></td>
* <td>{@link Sequencer}</td>
* <td>{@link #getSequencer}</td>
* </tr>
* <tr>
* <td><code>javax.sound.midi.Synthesizer</code></td>
* <td>{@link Synthesizer}</td>
* <td>{@link #getSynthesizer}</td>
* </tr>
* <tr>
* <td><code>javax.sound.midi.Transmitter</code></td>
* <td>{@link Transmitter}</td>
* <td>{@link #getTransmitter}</td>
* </tr>
* </table>
*
* The property value consists of the provider class name
* and the device name, separated by the hash mark ("#").
* The provider class name is the fully-qualified
* name of a concrete {@link javax.sound.midi.spi.MidiDeviceProvider
* MIDI device provider} class. The device name is matched against
* the <code>String</code> returned by the <code>getName</code>
* method of <code>MidiDevice.Info</code>.
* Either the class name, or the device name may be omitted.
* If only the class name is specified, the trailing hash mark
* is optional.
*
* <p>If the provider class is specified, and it can be
* successully retrieved from the installed providers,
=1= |