142 |
*/ |
*/ |
143 |
public static final int PITCH_BEND = 0xE0; |
public static final int PITCH_BEND = 0xE0; |
144 |
|
|
145 |
|
// Create and initialize a default, arbitrary message. |
146 |
|
private static byte[] defaultMessage; |
147 |
|
static |
148 |
|
{ |
149 |
|
defaultMessage = new byte[1]; |
150 |
|
defaultMessage[0] = (byte) STOP; |
151 |
|
} |
152 |
|
|
153 |
|
/** |
154 |
|
* Create a short MIDI message. |
155 |
|
* |
156 |
|
* The spec requires that this represent a valid MIDI message, but doesn't |
157 |
|
* specify what it should be. We've chosen the STOP message for our |
158 |
|
* implementation. |
159 |
|
*/ |
160 |
|
public ShortMessage() |
161 |
|
{ |
162 |
|
this(defaultMessage); |
163 |
|
} |
164 |
|
|
165 |
/** |
/** |
166 |
* Create a short MIDI message. |
* Create a short MIDI message. |
167 |
* |
* |
183 |
* @param data2 the second data byte for this message |
* @param data2 the second data byte for this message |
184 |
* @throws InvalidMidiDataException if status is bad, or data is out of range |
* @throws InvalidMidiDataException if status is bad, or data is out of range |
185 |
*/ |
*/ |
186 |
private void setMessage(int status, int data1, int data2) |
public void setMessage(int status, int data1, int data2) |
187 |
throws InvalidMidiDataException |
throws InvalidMidiDataException |
188 |
{ |
{ |
189 |
length = getDataLength(status); |
length = getDataLength(status); |
207 |
} |
} |
208 |
} |
} |
209 |
|
|
210 |
|
public void setMessage(int command, int channel, int data1, int data2) |
211 |
|
throws InvalidMidiDataException |
212 |
|
{ |
213 |
|
// TODO: This could probably stand some error checking. |
214 |
|
// It currently assumes command and channel are valid values. |
215 |
|
setMessage(command + channel, data1, data2); |
216 |
|
} |
217 |
|
|
218 |
/** |
/** |
219 |
* Set the MIDI message to one that requires no data bytes. |
* Set the MIDI message to one that requires no data bytes. |
220 |
* |
* |