当前位置: 首页>>代码示例>>Java>>正文


Java SysexMessage类代码示例

本文整理汇总了Java中javax.sound.midi.SysexMessage的典型用法代码示例。如果您正苦于以下问题:Java SysexMessage类的具体用法?Java SysexMessage怎么用?Java SysexMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SysexMessage类属于javax.sound.midi包,在下文中一共展示了SysexMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setLine

import javax.sound.midi.SysexMessage; //导入依赖的package包/类
public void setLine(int line, String text) {
	try {
		byte[] msg = new byte[77];
		Arrays.fill(msg, (byte)' ');
		int idx = 0;
		msg[idx++] = (byte) SysexMessage.SYSTEM_EXCLUSIVE;
		msg[idx++] = 71;
		msg[idx++] = 127;
		msg[idx++] = 21;
		msg[idx++] = (byte) (24+line);
		msg[idx++] = 0;
		msg[idx++] = 69;
		msg[idx++] = 0;
		for(int i = 0; i < Math.min(68,  text.length()); i++)
			msg[idx++] = (byte) (text.charAt(i) & 0x7F);
		msg[msg.length-1] = (byte) 247;

		send(new SysexMessage(msg, msg.length));
	} catch(Throwable t) {
		log.warning(t);
	}
}
 
开发者ID:arisona,项目名称:ether,代码行数:23,代码来源:AbletonPush.java

示例2: send

import javax.sound.midi.SysexMessage; //导入依赖的package包/类
@Override
public void send(MidiMessage message, long timeStamp) {
    try {
        if (sound) {
            midiPlugin.sound(message);
        }

        MidiMessageEvent<?> event;
        if (message instanceof ShortMessage) {
            event = MidiUtils.createShortMessageEvent(midiPlugin, (ShortMessage) message, timeStamp);
        } else if (message instanceof SysexMessage) {
            event = new MidiSysexMessageEvent(midiPlugin.getMidiSysexMessageEventName(),
                    midiPlugin.getEngine().getDefaultParameters().getEventClonePolicy(), (SysexMessage) message, timeStamp);
        } else if (message instanceof MetaMessage) {
            event = new MidiMetaMessageEvent(midiPlugin.getMidiMetaMessageEventName(),
                    midiPlugin.getEngine().getDefaultParameters().getEventClonePolicy(), (MetaMessage) message, timeStamp);
        } else {
            throw new SpongeException("Unknown MIDI message type: " + message.getClass());
        }

        midiPlugin.getEngine().getOperations().event(event).send();
    } catch (Exception e) {
        logger.error("send", e);
    }
}
 
开发者ID:softelnet,项目名称:sponge,代码行数:26,代码来源:MidiSpongeEventReceiver.java

示例3: parse

import javax.sound.midi.SysexMessage; //导入依赖的package包/类
/** 
 * Delegator method that calls specific parsers depending on the
 * type of MidiMessage passed in.
 * @param message the message to parse
 * @param timestamp the time at which the message was encountered in this track
 */
public void parse(MidiMessage message, long timestamp)
{
    if (message instanceof ShortMessage)
    {
        parseShortMessage((ShortMessage)message, timestamp);
    }
    else if (message instanceof SysexMessage)
    {
        parseSysexMessage((SysexMessage)message, timestamp);
    }
    else if (message instanceof MetaMessage)
    {
        parseMetaMessage((MetaMessage)message, timestamp);
    }
}
 
开发者ID:d2fn,项目名称:passage,代码行数:22,代码来源:MidiParser.java

示例4: addSysexBytes

import javax.sound.midi.SysexMessage; //导入依赖的package包/类
private void addSysexBytes(byte bytes[]) {
	for (byte b : bytes) {
		if (b == (byte)0xF7) {
			currentMessage.add((byte)0xF7);
			byte msg[] = new byte[currentMessage.size()];
			for (int i = 0; i < currentMessage.size(); i++) {
				msg[i] = ((Byte)currentMessage.get(i)).byteValue();
			}
			javax.sound.midi.SysexMessage newMsg = new javax.sound.midi.SysexMessage();
			try {
				newMsg.setMessage(msg, msg.length);
				for (Plug plug : plugList)
					plug.callPlug(this, newMsg);
			} catch (InvalidMidiDataException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		} else {
			currentMessage.add(b);
		}
	}
}
 
开发者ID:dearmash,项目名称:Processing,代码行数:23,代码来源:MidiInput.java

示例5: send

import javax.sound.midi.SysexMessage; //导入依赖的package包/类
public void send(final MidiMessage message, final long timeStamp) {
//		if ((message.getLength() >= 1)) {
//			System.out.println("message " + message);
//			printHex(message.getMessage());
//		}
		if (message instanceof javax.sound.midi.SysexMessage || message.getStatus() == (byte)0xF7) {
			if (message.getStatus() == 0xF0) {
//				System.out.println("clear message and start new ");
				currentMessage.clear(); // no shortcut for sysex messages
				currentMessage.add((byte)0xF0);
			}
			addSysexBytes(((javax.sound.midi.SysexMessage)message).getData());
			///
		} else {
			if (message.getStatus() >= 0xF8) {
				return;
			} else {
				if (message.getStatus() == 0xF7) {
					addSysexBytes(message.getMessage());
					return;
				}
			}
			for (Plug plug : plugList) 
				plug.callPlug(this, message);
		}
	}
 
开发者ID:dearmash,项目名称:Processing,代码行数:27,代码来源:MidiInput.java

示例6: 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;

}
 
开发者ID:bluenote10,项目名称:gervill,代码行数:18,代码来源:UniversalSysExBuilder.java

示例7: 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;
}
 
开发者ID:bluenote10,项目名称:gervill,代码行数:25,代码来源:UniversalSysExBuilder.java

示例8: 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;
}
 
开发者ID:bluenote10,项目名称:gervill,代码行数:21,代码来源:UniversalSysExBuilder.java

示例9: 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;
}
 
开发者ID:bluenote10,项目名称:gervill,代码行数:20,代码来源:UniversalSysExBuilder.java

示例10: 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;
}
 
开发者ID:bluenote10,项目名称:gervill,代码行数:20,代码来源:UniversalSysExBuilder.java

示例11: 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;
}
 
开发者ID:bluenote10,项目名称:gervill,代码行数:21,代码来源:UniversalSysExBuilder.java

示例12: 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;
}
 
开发者ID:bluenote10,项目名称:gervill,代码行数:26,代码来源:UniversalSysExBuilder.java

示例13: 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!"); }
}
 
开发者ID:Pecacheu,项目名称:LaunchPad-MC,代码行数:8,代码来源:LaunchPad.java

示例14: 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!"); }
}
 
开发者ID:Pecacheu,项目名称:LaunchPad-MC,代码行数:8,代码来源:LaunchPad.java

示例15: sysex

import javax.sound.midi.SysexMessage; //导入依赖的package包/类
static SysexMessage sysex(int ... data) {
	try {
		byte[] msg = new byte[data.length];
		for(int i = 0; i < msg.length; i++)
			msg[i] = (byte) data[i];
		return new SysexMessage(msg, msg.length);
	} catch(Throwable t) {
		log.warning(t);
		return null;
	}
}
 
开发者ID:arisona,项目名称:ether,代码行数:12,代码来源:AbletonPush.java


注:本文中的javax.sound.midi.SysexMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。