001 /* Synthesizer.java -- A MIDI audio synthesizer interface
002 Copyright (C) 2005 Free Software Foundation, Inc.
003
004 This file is part of GNU Classpath.
005
006 GNU Classpath is free software; you can redistribute it and/or modify
007 it under the terms of the GNU General Public License as published by
008 the Free Software Foundation; either version 2, or (at your option)
009 any later version.
010
011 GNU Classpath is distributed in the hope that it will be useful, but
012 WITHOUT ANY WARRANTY; without even the implied warranty of
013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014 General Public License for more details.
015
016 You should have received a copy of the GNU General Public License
017 along with GNU Classpath; see the file COPYING. If not, write to the
018 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
019 02110-1301 USA.
020
021 Linking this library statically or dynamically with other modules is
022 making a combined work based on this library. Thus, the terms and
023 conditions of the GNU General Public License cover the whole
024 combination.
025
026 As a special exception, the copyright holders of this library give you
027 permission to link this library with independent modules to produce an
028 executable, regardless of the license terms of these independent
029 modules, and to copy and distribute the resulting executable under
030 terms of your choice, provided that you also meet, for each linked
031 independent module, the terms and conditions of the license of that
032 module. An independent module is a module which is not derived from
033 or based on this library. If you modify this library, you may extend
034 this exception to your version of the library, but you are not
035 obligated to do so. If you do not wish to do so, delete this
036 exception statement from your version. */
037
038
039 package javax.sound.midi;
040
041 /**
042 * Interface for MIDI audio synthesizer devices.
043 *
044 * @author Anthony Green (green@redhat.com)
045 * @since 1.3
046 *
047 */
048 public interface Synthesizer extends MidiDevice
049 {
050 /**
051 * Get the maximum number of notes that the synth can play at once.
052 *
053 * @return the maximum number of notes that the synth can play at once
054 */
055 public int getMaxPolyphony();
056
057 /**
058 * The processing latency for this synth in microseconds.
059 *
060 * @return the processing latency for this synth in microseconds
061 */
062 public long getLatency();
063
064 /**
065 * Get the set of MIDI channels controlled by this synth.
066 *
067 * @return an array of MIDI channels controlled by this synth
068 */
069 public MidiChannel[] getChannels();
070
071 /**
072 * Get the current status for the voices produced by this synth.
073 *
074 * @return an array of VoiceStatus objects, getMaxPolyphony() in length
075 */
076 public VoiceStatus[] getVoiceStatus();
077
078 /**
079 * Returns true is this synth is capable of loading soundbank.
080 *
081 * @param soundbank the Soundbank to examine
082 * @return true if soundbank can be loaded, false otherwise
083 */
084 public boolean isSoundbankSupported(Soundbank soundbank);
085
086 /**
087 * Load an instrument into this synth. The instrument must be part of a
088 * supported soundbank.
089 *
090 * @param instrument the Instrument to load
091 * @return true if the instrument was loaded and false otherwise
092 * @throws IllegalArgumentException if this synth doesn't support instrument
093 */
094 public boolean loadInstrument(Instrument instrument);
095
096 /**
097 * Unload an instrument from this synth.
098 *
099 * @param instrument the Instrument to unload
100 * @throws IllegalArgumentException if this synth doesn't support instrument
101 */
102 public void unloadInstrument(Instrument instrument);
103
104 /**
105 * Move an intrument from one place to another. The instrument at the
106 * target location is unloaded.
107 *
108 * @param from the instrument source
109 * @param to the instrument target
110 * @return if from was remapped
111 * @throws IllegalArgumentException
112 */
113 public boolean remapInstrument(Instrument from, Instrument to);
114
115 /**
116 * Get the default Soundbank for this synth. Return null if there is no
117 * default.
118 *
119 * @return the default Soundbank for this synth, possibly null.
120 */
121 public Soundbank getDefaultSoundbank();
122
123 /**
124 * Get an array containing all instruments in this synthesizer.
125 *
126 * @return an array containing all instruments in this synthesizer
127 */
128 public Instrument[] getAvailableInstruments();
129
130 /**
131 * Get an array containing all instruments loaded in this synthesizer.
132 *
133 * @return an array containing all instruments loaded in this synthesizer
134 */
135 public Instrument[] getLoadedInstruments();
136
137 /**
138 * Load all soundbank instruments into this synthesizer.
139 *
140 * @param soundbank the Soundbank from which to load instruments
141 * @return true if all instruments were loaded, false othewise
142 * @throws IllegalArgumentException if the soundbank isn't supported by this
143 */
144 public boolean loadAllInstruments(Soundbank soundbank);
145
146 /**
147 * Unload all soundbank instruments from this synthesizer.
148 *
149 * @param soundbank the Soundbank containing the instruments to unload
150 * @throws IllegalArgumentException if the soundbank isn't supported by this
151 */
152 public void unloadAllInstruments(Soundbank soundbank);
153
154 /**
155 * Load a subset of soundbank instruments into this synthesizer. The
156 * subset is defined by an array of Patch objects.
157 *
158 * @param soundbank the Soundbank from which to load instruments
159 * @param patchList the array of patches identifying instruments to load
160 * @return true if instruments were loaded, false otherwise
161 * @throws IllegalArgumentException if the soundbank isn't supported by this
162 */
163 public boolean loadInstruments(Soundbank soundbank, Patch[] patchList);
164
165 /**
166 * Unload a subset of soundbank instruments from this synthesizer.
167 *
168 * @param soundbank the Soundbank containing the instruments to unload
169 * @param patchList the array of patches identifying instruments to unload
170 * @throws IllegalArgumentException if the soundbank isn't supported by this
171 */
172 public void unloadInstruments(Soundbank soundbank, Patch[] patchList);
173 }