本文整理汇总了Java中javax.sound.midi.SysexMessage.setMessage方法的典型用法代码示例。如果您正苦于以下问题:Java SysexMessage.setMessage方法的具体用法?Java SysexMessage.setMessage怎么用?Java SysexMessage.setMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.sound.midi.SysexMessage
的用法示例。
在下文中一共展示了SysexMessage.setMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setDeviceControl
import javax.sound.midi.SysexMessage; //导入方法依赖的package包/类
private static SysexMessage setDeviceControl(int targetDevice,
int control, int value) throws IOException,
InvalidMidiDataException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write(UNIVERSAL_REALTIME_SYSEX_HEADER);
baos.write((byte) targetDevice);
baos.write(DEVICE_CONTROL);
baos.write((byte) control);
baos.write((byte) (value % 128));
baos.write((byte) (value / 128));
baos.write(EOX);
SysexMessage sysex = new SysexMessage();
byte[] data = baos.toByteArray();
sysex.setMessage(data, data.length);
return sysex;
}
示例2: setGlobalParameter
import javax.sound.midi.SysexMessage; //导入方法依赖的package包/类
public static SysexMessage setGlobalParameter(int targetDevice,
short[] slotpath, byte[] parameter, byte[] value)
throws IOException, InvalidMidiDataException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write(UNIVERSAL_REALTIME_SYSEX_HEADER);
baos.write((byte) targetDevice);
baos.write(DEVICE_CONTROL);
baos.write(GLOBAL_PARAMETER_CONTROL);
baos.write((byte) slotpath.length);
baos.write((byte) parameter.length);
baos.write((byte) value.length);
for (int i = 0; i < slotpath.length; i++) {
short x = slotpath[0];
baos.write((byte) (x >>> 8));
baos.write((byte) x);
}
baos.write(parameter);
baos.write(value);
baos.write(EOX);
SysexMessage sysex = new SysexMessage();
byte[] data = baos.toByteArray();
sysex.setMessage(data, data.length);
return sysex;
}
示例3: setKeyBasedControl
import javax.sound.midi.SysexMessage; //导入方法依赖的package包/类
public static SysexMessage setKeyBasedControl(int targetDevice,
int midi_channel, int key_number, int[] controls, int[] values)
throws IOException, InvalidMidiDataException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write(UNIVERSAL_REALTIME_SYSEX_HEADER);
baos.write((byte) targetDevice);
baos.write(KEY_BASED_INSTRUMENT_CONTROL);
baos.write(BASIC_MESSAGE);
baos.write((byte) midi_channel);
baos.write((byte) key_number);
for (int i = 0; i < controls.length; i++) {
baos.write((byte) controls[i]);
baos.write((byte) values[i]);
}
baos.write(EOX);
SysexMessage sysex = new SysexMessage();
byte[] data = baos.toByteArray();
sysex.setMessage(data, data.length);
return sysex;
}
示例4: setControllerDestinationForChannelPressure
import javax.sound.midi.SysexMessage; //导入方法依赖的package包/类
public static SysexMessage setControllerDestinationForChannelPressure(
int targetDevice, int channel, int[] controls, int[] ranges)
throws IOException, InvalidMidiDataException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write(UNIVERSAL_REALTIME_SYSEX_HEADER);
baos.write((byte) targetDevice);
baos.write(CONTROLLER_DESTINATION_SETTINGS);
baos.write(CONTROLLER_CHANNEL_PRESSURE);
baos.write((byte) channel);
for (int i = 0; i < controls.length; i++) {
baos.write((byte) controls[i]);
baos.write((byte) ranges[i]);
}
baos.write(EOX);
SysexMessage sysex = new SysexMessage();
byte[] data = baos.toByteArray();
sysex.setMessage(data, data.length);
return sysex;
}
示例5: setControllerDestinationForPolyPressure
import javax.sound.midi.SysexMessage; //导入方法依赖的package包/类
public static SysexMessage setControllerDestinationForPolyPressure(
int targetDevice, int channel, int[] controls, int[] ranges)
throws IOException, InvalidMidiDataException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write(UNIVERSAL_REALTIME_SYSEX_HEADER);
baos.write((byte) targetDevice);
baos.write(CONTROLLER_DESTINATION_SETTINGS);
baos.write(CONTROLLER_POLY_PRESSURE);
baos.write((byte) channel);
for (int i = 0; i < controls.length; i++) {
baos.write((byte) controls[i]);
baos.write((byte) ranges[i]);
}
baos.write(EOX);
SysexMessage sysex = new SysexMessage();
byte[] data = baos.toByteArray();
sysex.setMessage(data, data.length);
return sysex;
}
示例6: setControllerDestinationForControlChange
import javax.sound.midi.SysexMessage; //导入方法依赖的package包/类
public static SysexMessage setControllerDestinationForControlChange(
int targetDevice, int channel, byte control, int[] controls,
int[] ranges) throws IOException, InvalidMidiDataException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write(UNIVERSAL_REALTIME_SYSEX_HEADER);
baos.write((byte) targetDevice);
baos.write(CONTROLLER_DESTINATION_SETTINGS);
baos.write(CONTROLLER_CONTROL_CHANGE);
baos.write((byte) channel);
baos.write((byte) control);
for (int i = 0; i < controls.length; i++) {
baos.write((byte) controls[i]);
baos.write((byte) ranges[i]);
}
baos.write(EOX);
SysexMessage sysex = new SysexMessage();
byte[] data = baos.toByteArray();
sysex.setMessage(data, data.length);
return sysex;
}
示例7: singleNoteTuningChange
import javax.sound.midi.SysexMessage; //导入方法依赖的package包/类
public static SysexMessage singleNoteTuningChange(int targetDevice,
int preset, int[] key_numbers, int[] key_tunings)
throws IOException, InvalidMidiDataException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write(UNIVERSAL_REALTIME_SYSEX_HEADER);
baos.write((byte) targetDevice);
baos.write(MIDI_TUNING_STANDARD);
baos.write(SINGLE_NOTE_TUNING_CHANGE);
baos.write((byte) preset);
baos.write((byte) key_numbers.length);
for (int i = 0; i < key_numbers.length; i++) {
baos.write((byte) key_numbers[i]);
int t = key_tunings[i];
baos.write((byte) ((t / 16384) % 128));
baos.write((byte) ((t / 128) % 128));
baos.write((byte) (t % 128));
}
baos.write(EOX);
SysexMessage sysex = new SysexMessage();
byte[] data = baos.toByteArray();
sysex.setMessage(data, data.length);
return sysex;
}
示例8: sysex
import javax.sound.midi.SysexMessage; //导入方法依赖的package包/类
private void sysex(ChuList<Integer> data) {
data.addAll(0, new Integer[]{0,32,41,2,16}); data.add(247);
SysexMessage msg = new SysexMessage(); byte[] dBytes = new byte[data.length];
for(int i=0,l=data.length; i<l; i++) dBytes[i] = data.get(i).byteValue();
try { msg.setMessage(240, dBytes, dBytes.length); synchronized(this) { cue.add(msg); }} catch
(InvalidMidiDataException e) { debug("Error in LaunchPad:SysEx: Invalid data!"); }
}
示例9: sysexDirect
import javax.sound.midi.SysexMessage; //导入方法依赖的package包/类
private void sysexDirect(ChuList<Byte> data) {
data.addAll(0, new Byte[]{0,32,41,2,16}); data.add((byte)247);
SysexMessage msg = new SysexMessage(); byte[] dBytes = new byte[data.length];
for(int i=0,l=data.length; i<l; i++) dBytes[i] = data.get(i);
try { msg.setMessage(240, dBytes, dBytes.length); midiOut.send(msg, -1); } catch
(InvalidMidiDataException e) { debug("Error in LaunchPad:SysEx: Invalid data!"); }
}
示例10: parseMessages
import javax.sound.midi.SysexMessage; //导入方法依赖的package包/类
/**
* Entry method called from SysexEvent.
* Default implementation assumes a single sysex message to be parsed
* and thus delegates to parse(String).
* @param macro
* @return
*/
public MidiMessage[] parseMessages(String macro) throws InvalidMidiDataException {
byte[] data = parse(macro);
SysexMessage syxm = new SysexMessage();
syxm.setMessage(data, data.length);
MidiMessage[] mm = { syxm };
return mm;
}
示例11: setData
import javax.sound.midi.SysexMessage; //导入方法依赖的package包/类
public void setData(byte[] data) {
// single raw sysex message
try {
SysexMessage syxm = new SysexMessage();
syxm.setMessage(data, data.length);
midiEvents = new MidiEvent[] { new MidiEvent(syxm, startTick) };
} catch (InvalidMidiDataException imde) {
imde.printStackTrace();
}
}
示例12: parseMessages
import javax.sound.midi.SysexMessage; //导入方法依赖的package包/类
/**
* Macro: e70fx <reverb-type> <reverb-intensity> <chorus-type> <chorus-intensity> [ <user-prg> ] [ <use-prg-change> ]
*
* Sets the built-in reverb-effect style on one of the user-programs.
* There are two modes of operation:
* In order to overcome the limitation that the actively
* selected user-program cannot be configured via sysex, the current
* user-program will be changed to before sending the sysex message
* and after having made the changes will be switched back again.
* This has the effect that after setting the effect this way, the
* <user-prg> will be the actively selected one, even if it hadn't
* been selected before.
* To disable the special behaviour of switching user-programs, use
*
* arg[0]: reverb-type (0: none, 1: room1, 2: room2, 3: room3, 4: hall1, etc.)
* arg[1]: reverb-intensity (0-7)
* arg[2]: chorus-type (0: none, 1: chorus1, 2: chorus2, etc.)
* arg[3]: chorus-intensity (0-7)
* arg[4] (optional): user-program to modify, default "11" (0)
* arg[5] (optional): channel on which to send user program switch, may differ
* from current Frinika-track's channel. Default is 16 (i.e.
* 15 if counting from 0 to 15), use -1 to disable sending
* user-program changes before and after the sysex data.
*/
public MidiMessage[] parseMessages(String macro) throws InvalidMidiDataException {
String[] args = splitArgs(macro);
int usrPrg = 0;
int chn = 15;
if (args.length > 4) {
usrPrg = parseInt(args[4], 10);
}
if (args.length > 5) {
chn = parseInt(args[5], 10);
}
byte[] data = parse(args); // get sysex data
SysexMessage syxm = new SysexMessage();
syxm.setMessage(data, data.length);
if ((chn >= 0) && (chn <= 15)) {
int otherUsrPrg = (usrPrg == 0) ? 1 : 0;
MidiMessage[] prgChg = usrPrgChg( otherUsrPrg, chn );
MidiMessage[] prgChgBack = usrPrgChg( usrPrg, chn );
MidiMessage[] mm = { prgChg[0], prgChg[1], prgChg[2],
syxm,
prgChgBack[0], prgChgBack[1], prgChgBack[2] };
return mm;
} else {
return new MidiMessage[] { syxm };
}
}
示例13: sendSysexMessage
import javax.sound.midi.SysexMessage; //导入方法依赖的package包/类
private static void sendSysexMessage(Receiver receiver, byte... message) {
SysexMessage msg = new SysexMessage();
try {
msg.setMessage(message, message.length);
} catch (InvalidMidiDataException ex) {
throw new RuntimeException(ex);
}
receiver.send(msg, -1);
}
示例14: addSysExMessage
import javax.sound.midi.SysexMessage; //导入方法依赖的package包/类
private void addSysExMessage(int status, byte... data) {
try {
SysexMessage msg = new SysexMessage();
msg.setMessage(status, data, data.length);
messages.add(msg);
} catch (InvalidMidiDataException ex) {
throw new RuntimeException(ex);
}
}
示例15: setGeneralMidiMessage
import javax.sound.midi.SysexMessage; //导入方法依赖的package包/类
private static SysexMessage setGeneralMidiMessage(int targetDevice,
byte type) throws IOException, InvalidMidiDataException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.write(UNIVERSAL_NON_REALTIME_SYSEX_HEADER);
baos.write((byte) targetDevice);
baos.write(GENERAL_MIDI_MESSAGES);
baos.write(type);
baos.write(EOX);
SysexMessage sysex = new SysexMessage();
byte[] data = baos.toByteArray();
sysex.setMessage(data, data.length);
return sysex;
}