001/* MidiChannel.java -- A MIDI channel
002   Copyright (C) 2005 Free Software Foundation, Inc.
003
004This file is part of GNU Classpath.
005
006GNU Classpath is free software; you can redistribute it and/or modify
007it under the terms of the GNU General Public License as published by
008the Free Software Foundation; either version 2, or (at your option)
009any later version.
010
011GNU Classpath is distributed in the hope that it will be useful, but
012WITHOUT ANY WARRANTY; without even the implied warranty of
013MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014General Public License for more details.
015
016You should have received a copy of the GNU General Public License
017along with GNU Classpath; see the file COPYING.  If not, write to the
018Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
01902110-1301 USA.
020
021Linking this library statically or dynamically with other modules is
022making a combined work based on this library.  Thus, the terms and
023conditions of the GNU General Public License cover the whole
024combination.
025
026As a special exception, the copyright holders of this library give you
027permission to link this library with independent modules to produce an
028executable, regardless of the license terms of these independent
029modules, and to copy and distribute the resulting executable under
030terms of your choice, provided that you also meet, for each linked
031independent module, the terms and conditions of the license of that
032module.  An independent module is a module which is not derived from
033or based on this library.  If you modify this library, you may extend
034this exception to your version of the library, but you are not
035obligated to do so.  If you do not wish to do so, delete this
036exception statement from your version. */
037
038
039package javax.sound.midi;
040
041/**
042 * A MIDI channel.
043 *
044 * @author Anthony Green (green@redhat.com)
045 * @since 1.3
046 *
047 */
048public interface MidiChannel
049{
050
051  /**
052   * Start playing a note.
053   *
054   * @param noteNumber the MIDI note number
055   * @param velocity the velocity at which the key was pressed
056   */
057  public void noteOn(int noteNumber, int velocity);
058
059  /**
060   * Stop playing a note.
061   *
062   * @param noteNumber the MIDI note number
063   * @param velocity the volcity at which the ket was released
064   */
065  public void noteOff(int noteNumber, int velocity);
066
067  /**
068   * Stop playing a note.
069   *
070   * @param noteNumber the MIDI note number
071   */
072  public void noteOff(int noteNumber);
073
074  /**
075   * Change in a key pressure for a note.
076   *
077   * @param noteNumber the MIDI note number
078   * @param pressure the key pressure
079   */
080  public void setPolyPressure(int noteNumber, int pressure);
081
082  /**
083   * Get the key pressure for a note.
084   *
085   * @param noteNumber the MIDI note number
086   * @return the key pressure
087   */
088  public int getPolyPressure(int noteNumber);
089
090  /**
091   * Set the key pressure for the channel.
092   *
093   * @param pressure the key pressure
094   */
095  public void setChannelPressure(int pressure);
096
097  /**
098   * Get the key pressure for the channel.
099   *
100   * @return the key pressure
101   */
102  public int getChannelPressure();
103
104  /**
105   * Set a change in a controller's value.
106   *
107   * @param controller the MIDI controller number (0 to 127)
108   * @param value the new value (0 to 127)
109   */
110  public void controlChange(int controller, int value);
111
112  /**
113   * Get a controller's value.
114   *
115   * @param controller the MIDI controller number (0 to 127)
116   * @return the controller's value (0 to 127)
117   */
118  public int getController(int controller);
119
120  /**
121   * Change the patch for this channel.
122   *
123   * @param program the patch number to switch to (0 to 127)
124   */
125  public void programChange(int program);
126
127  /**
128   * Change the bank and patch for this channel.
129   *
130   * @param bank the bank to switch to (0 to 16383)
131   * @param program the patch to switch to (0 to 127)
132   */
133  public void programChange(int bank, int program);
134
135  /**
136   * Get the current patch for this channel.
137   *
138   * @return current patch (0 to 127)
139   */
140  public int getProgram();
141
142  /**
143   * Change the pitch bend for this channel using a positive 14-bit value.
144   *
145   * @param bend the new pitch bend value
146   */
147  public void setPitchBend(int bend);
148
149  /**
150   * Get the pitch bend for this channel as a positive 14-bit value.
151   *
152   * @return the current patch bend value
153   */
154  public int getPitchBend();
155
156  /**
157   * Reset all MIDI controllers to their default values.
158   */
159  public void resetAllControllers();
160
161  /**
162   * Stop playing all notes.  Sound may not stop.
163   */
164  public void allNotesOff();
165
166  /**
167   * Stop all sound.
168   */
169  public void allSoundOff();
170
171  /**
172   * Set whether or not local controls are on or off.  They are on by
173   * default.
174   *
175   * @param on true to enable local controls, false to disable
176   * @return the new value
177   */
178  public boolean localControl(boolean on);
179
180  /**
181   * Turns mono mode on or off.
182   *
183   * @param on true to enable mono mode, false to disable
184   */
185  public void setMono(boolean on);
186
187  /**
188   * Get the current mono mode.
189   *
190   * @return true if mono is enabled, false otherwise
191   */
192  public boolean getMono();
193
194  /**
195   * Turns omni mode on or off.
196   *
197   * @param on true to enable omni mode, false to disable
198   */
199  public void setOmni(boolean on);
200
201  /**
202   * Get the current omni mode.
203   *
204   * @return true if omni is enabled, false otherwise
205   */
206  public boolean getOmni();
207
208  /**
209   * Turns mute mode on or off.
210   *
211   * @param mute true to enable mute mode, false to disable
212   */
213  public void setMute(boolean mute);
214
215  /**
216   * Get the current mute mode.
217   *
218   * @return true if mute is enabled, false otherwise
219   */
220  public boolean getMute();
221
222  /**
223   * Turns solo mode on or off.  If any channels are soloed, then only those
224   * channels make sounds, otherwise all channels will make sound.
225   *
226   * @param solo true to enable solo mode, false to disable
227   */
228  public void setSolo(boolean solo);
229
230  /**
231   * Get the current solo mode.
232   *
233   * @return true is solo is enabled, false otherwise.
234   */
235  public boolean getSolo();
236}