1 /*
2 * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
57 * one or more {@code MidiSystem} methods to learn what devices are installed
58 * and to obtain the ones needed in that application.
59 * <p>
60 * The class also has methods for reading files, streams, and URLs that contain
61 * standard MIDI file data or soundbanks. You can query the {@code MidiSystem}
62 * for the format of a specified MIDI file.
63 * <p>
64 * You cannot instantiate a {@code MidiSystem}; all the methods are static.
65 * <p>
66 * Properties can be used to specify default MIDI devices. Both system
67 * properties and a properties file are considered. The "sound.properties"
68 * properties file is read from an implementation-specific location (typically
69 * it is the {@code conf} directory in the Java installation directory). If a
70 * property exists both as a system property and in the properties file, the
71 * system property takes precedence. If none is specified, a suitable default is
72 * chosen among the available devices. The syntax of the properties file is
73 * specified in {@link Properties#load(InputStream) Properties.load}. The
74 * following table lists the available property keys and which methods consider
75 * them:
76 *
77 * <table border=0>
78 * <caption>MIDI System Property Keys</caption>
79 * <tr>
80 * <th>Property Key</th>
81 * <th>Interface</th>
82 * <th>Affected Method</th>
83 * </tr>
84 * <tr>
85 * <td>{@code javax.sound.midi.Receiver}</td>
86 * <td>{@link Receiver}</td>
87 * <td>{@link #getReceiver}</td>
88 * </tr>
89 * <tr>
90 * <td>{@code javax.sound.midi.Sequencer}</td>
91 * <td>{@link Sequencer}</td>
92 * <td>{@link #getSequencer}</td>
93 * </tr>
94 * <tr>
95 * <td>{@code javax.sound.midi.Synthesizer}</td>
96 * <td>{@link Synthesizer}</td>
97 * <td>{@link #getSynthesizer}</td>
98 * </tr>
99 * <tr>
100 * <td>{@code javax.sound.midi.Transmitter}</td>
101 * <td>{@link Transmitter}</td>
102 * <td>{@link #getTransmitter}</td>
103 * </tr>
104 * </table>
105 *
106 * The property value consists of the provider class name and the device name,
107 * separated by the hash mark ("#"). The provider class name is the
108 * fully-qualified name of a concrete
109 * {@link MidiDeviceProvider MIDI device provider} class. The device name is
110 * matched against the {@code String} returned by the {@code getName} method of
111 * {@code MidiDevice.Info}. Either the class name, or the device name may be
112 * omitted. If only the class name is specified, the trailing hash mark is
113 * optional.
114 * <p>
115 * If the provider class is specified, and it can be successfully retrieved from
116 * the installed providers, the list of {@code MidiDevice.Info} objects is
117 * retrieved from the provider. Otherwise, or when these devices do not provide
118 * a subsequent match, the list is retrieved from {@link #getMidiDeviceInfo} to
119 * contain all available {@code MidiDevice.Info} objects.
120 * <p>
121 * If a device name is specified, the resulting list of {@code MidiDevice.Info}
122 * objects is searched: the first one with a matching name, and whose
123 * {@code MidiDevice} implements the respective interface, will be returned. If
|
1 /*
2 * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
57 * one or more {@code MidiSystem} methods to learn what devices are installed
58 * and to obtain the ones needed in that application.
59 * <p>
60 * The class also has methods for reading files, streams, and URLs that contain
61 * standard MIDI file data or soundbanks. You can query the {@code MidiSystem}
62 * for the format of a specified MIDI file.
63 * <p>
64 * You cannot instantiate a {@code MidiSystem}; all the methods are static.
65 * <p>
66 * Properties can be used to specify default MIDI devices. Both system
67 * properties and a properties file are considered. The "sound.properties"
68 * properties file is read from an implementation-specific location (typically
69 * it is the {@code conf} directory in the Java installation directory). If a
70 * property exists both as a system property and in the properties file, the
71 * system property takes precedence. If none is specified, a suitable default is
72 * chosen among the available devices. The syntax of the properties file is
73 * specified in {@link Properties#load(InputStream) Properties.load}. The
74 * following table lists the available property keys and which methods consider
75 * them:
76 *
77 * <table class="striped">
78 * <caption>MIDI System Property Keys</caption>
79 * <thead>
80 * <tr>
81 * <th>Property Key</th>
82 * <th>Interface</th>
83 * <th>Affected Method</th>
84 * </tr>
85 * </thead>
86 * <tbody>
87 * <tr>
88 * <td>{@code javax.sound.midi.Receiver}</td>
89 * <td>{@link Receiver}</td>
90 * <td>{@link #getReceiver}</td>
91 * </tr>
92 * <tr>
93 * <td>{@code javax.sound.midi.Sequencer}</td>
94 * <td>{@link Sequencer}</td>
95 * <td>{@link #getSequencer}</td>
96 * </tr>
97 * <tr>
98 * <td>{@code javax.sound.midi.Synthesizer}</td>
99 * <td>{@link Synthesizer}</td>
100 * <td>{@link #getSynthesizer}</td>
101 * </tr>
102 * <tr>
103 * <td>{@code javax.sound.midi.Transmitter}</td>
104 * <td>{@link Transmitter}</td>
105 * <td>{@link #getTransmitter}</td>
106 * </tr>
107 * </tbody>
108 * </table>
109 *
110 * The property value consists of the provider class name and the device name,
111 * separated by the hash mark ("#"). The provider class name is the
112 * fully-qualified name of a concrete
113 * {@link MidiDeviceProvider MIDI device provider} class. The device name is
114 * matched against the {@code String} returned by the {@code getName} method of
115 * {@code MidiDevice.Info}. Either the class name, or the device name may be
116 * omitted. If only the class name is specified, the trailing hash mark is
117 * optional.
118 * <p>
119 * If the provider class is specified, and it can be successfully retrieved from
120 * the installed providers, the list of {@code MidiDevice.Info} objects is
121 * retrieved from the provider. Otherwise, or when these devices do not provide
122 * a subsequent match, the list is retrieved from {@link #getMidiDeviceInfo} to
123 * contain all available {@code MidiDevice.Info} objects.
124 * <p>
125 * If a device name is specified, the resulting list of {@code MidiDevice.Info}
126 * objects is searched: the first one with a matching name, and whose
127 * {@code MidiDevice} implements the respective interface, will be returned. If
|