001 /* MidiChannel.java -- A MIDI channel 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 * A MIDI channel. 043 * 044 * @author Anthony Green (green@redhat.com) 045 * @since 1.3 046 * 047 */ 048 public 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 }