• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java OSCBundle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: convertBundle

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
/**
 * Converts the byte array to a bundle.
 * Assumes that the byte array is a bundle.
 * @return a bundle containing the data specified in the byte stream
 */
private OSCBundle convertBundle() {
	// skip the "#bundle " stuff
	streamPosition = 8;
	Date timestamp = readTimeTag();
	OSCBundle bundle = new OSCBundle(timestamp);
	OSCByteArrayToJavaConverter myConverter
			= new OSCByteArrayToJavaConverter();
	while (streamPosition < bytesLength) {
		// recursively read through the stream and convert packets you find
		int packetLength = ((Integer) readInteger()).intValue();
		byte[] packetBytes = new byte[packetLength];
		for (int i = 0; i < packetLength; i++) {
			packetBytes[i] = bytes[streamPosition++];
		}
		OSCPacket packet = myConverter.convert(packetBytes, packetLength);
		bundle.addPacket(packet);
	}
	return bundle;
}
 
开发者ID:gutugutu3030,项目名称:gprintMode,代码行数:25,代码来源:OSCByteArrayToJavaConverter.java


示例2: cursorDelete

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
/**
 * Cursor delete.
 */
public void cursorDelete()
{
	OSCBundle cursorBundle = new OSCBundle();

	OSCMessage remoteMessage = new OSCMessage("/tuio/2Dcur");
	remoteMessage.addArgument("source");
	remoteMessage.addArgument("vision");

	OSCMessage aliveMessage = new OSCMessage("/tuio/2Dcur");
	aliveMessage.addArgument("alive");

	cursorBundle.addPacket(remoteMessage);
	cursorBundle.addPacket(aliveMessage);

	sendOSC(cursorBundle);
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:20,代码来源:TableSimTUIOComms.java


示例3: multiCursorMessage

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
/**
 * Multi cursor message.
 *
 * @param cursors
 *            the cursors
 */
public void multiCursorMessage(IndividualCursor[] cursors)
{
	OSCBundle cursorBundle = new OSCBundle();

	OSCMessage remoteMessage1 = new OSCMessage("/tuio/2Dcur");
	remoteMessage1.addArgument("source");
	remoteMessage1.addArgument("vision");

	OSCMessage aliveMessage1 = new OSCMessage("/tuio/2Dcur");
	aliveMessage1.addArgument("alive");
	for (int i = 0; i < cursors.length; i++)
	{
		aliveMessage1.addArgument(new Integer(cursors[i].id));
	}

	cursorBundle.addPacket(remoteMessage1);
	cursorBundle.addPacket(aliveMessage1);

	for (int i = 0; i < cursors.length; i++)
	{
		addCursorInfoToBundle(cursors[i], cursorBundle);
	}

	sendOSC(cursorBundle);
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:32,代码来源:TableSimTUIOComms.java


示例4: reset

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
/**
 * Reset.
 */
public void reset()
{
	OSCBundle oscBundle = new OSCBundle();

	OSCMessage remoteMessage = new OSCMessage("/tuio/2Dobj");
	remoteMessage.addArgument("source");
	remoteMessage.addArgument("vision");

	OSCMessage aliveMessage = new OSCMessage("/tuio/2Dobj");
	aliveMessage.addArgument("alive");

	currentFrame++;
	OSCMessage frameMessage = new OSCMessage("/tuio/2Dobj");
	frameMessage.addArgument("fseq");
	frameMessage.addArgument(new Integer(currentFrame));

	oscBundle.addPacket(remoteMessage);
	oscBundle.addPacket(aliveMessage);
	oscBundle.addPacket(frameMessage);

	sendOSC(oscBundle);
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:26,代码来源:TableSimTUIOComms.java


示例5: singleCursorMessage

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
/**
 * Single cursor message.
 *
 * @param cursorInfo
 *            the cursor info
 */
public void singleCursorMessage(IndividualCursor cursorInfo)
{
	OSCBundle cursorBundle = new OSCBundle();

	OSCMessage remoteMessage = new OSCMessage("/tuio/2Dcur");
	remoteMessage.addArgument("source");
	remoteMessage.addArgument("vision");

	OSCMessage aliveMessage = new OSCMessage("/tuio/2Dcur");
	aliveMessage.addArgument("alive");
	aliveMessage.addArgument(new Integer(cursorInfo.id));

	cursorBundle.addPacket(remoteMessage);
	cursorBundle.addPacket(aliveMessage);

	addCursorInfoToBundle(cursorInfo, cursorBundle);
	sendOSC(cursorBundle);
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:25,代码来源:TableSimTUIOComms.java


示例6: convertBundle

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
/**
 * Convert bundle.
 *
 * @return the OSC bundle
 */
private OSCBundle convertBundle()
{
	// skip the "#bundle " stuff
	streamPosition = 8;
	Date timestamp = readTimeTag();
	OSCBundle bundle = new OSCBundle(timestamp);
	OSCByteArrayToJavaConverter myConverter = new OSCByteArrayToJavaConverter();
	while (streamPosition < bytesLength)
	{
		// recursively read through the stream and convert packets you find
		int packetLength = ((Integer) readInteger()).intValue();
		byte[] packetBytes = new byte[packetLength];
		// streamPosition++;
		System.arraycopy(bytes, streamPosition, packetBytes, 0, packetLength);
		streamPosition += packetLength;
		// for (int i = 0; i < packetLength; i++)
		// packetBytes[i] = bytes[streamPosition++];
		OSCPacket packet = myConverter.convert(packetBytes, packetLength);
		bundle.addPacket(packet);
	}
	return bundle;
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:28,代码来源:OSCByteArrayToJavaConverter.java


示例7: readTimeTag

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
/**
 * @return a Date
 */
private Date readTimeTag()
{
	// byte[] secondBytes = new byte[8];
	// byte[] picosecBytes = new byte[8];
	/*
	 * for (int i = 4; i < 8; i++) secondBytes[i] = bytes[streamPosition++];
	 * for (int i = 4; i < 8; i++) picosecBytes[i] =
	 * bytes[streamPosition++];
	 */
	System.arraycopy(bytes, streamPosition, secondBytes, 4, 4);
	streamPosition += 4;
	System.arraycopy(bytes, streamPosition, picosecBytes, 4, 4);
	streamPosition += 4;

	BigInteger secsSince1900 = new BigInteger(secondBytes);
	long secsSince1970 = secsSince1900.longValue() - OSCBundle.SECONDS_FROM_1900_to_1970.longValue();
	if (secsSince1970 < 0)
	{
		secsSince1970 = 0; // no point maintaining times in the distant past
	}
	BigInteger picosecs = new BigInteger(picosecBytes);
	long millisecs = (secsSince1970 * 1000) + (picosecs.longValue() / 1000);
	return new Date(millisecs);
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:28,代码来源:OSCByteArrayToJavaConverter.java


示例8: convertBundle

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
/**
 * Converts the byte array to a bundle.
 * Assumes that the byte array is a bundle.
 * @return a bundle containing the data specified in the byte stream
 */
private OSCBundle convertBundle() {
	// skip the "#bundle " stuff
	streamPosition = BUNDLE_START.length() + 1;
	Date timestamp = readTimeTag();
	OSCBundle bundle = new OSCBundle(timestamp);
	OSCByteArrayToJavaConverter myConverter
			= new OSCByteArrayToJavaConverter();
	myConverter.setCharset(charset);
	while (streamPosition < bytesLength) {
		// recursively read through the stream and convert packets you find
		final int packetLength = readInteger();
		if (packetLength == 0) {
			throw new IllegalArgumentException("Packet length may not be 0");
		} else if ((packetLength % 4) != 0) {
			throw new IllegalArgumentException("Packet length has to be a multiple of 4, is:"
					+ packetLength);
		}
		final byte[] packetBytes = new byte[packetLength];
		System.arraycopy(bytes, streamPosition, packetBytes, 0, packetLength);
		streamPosition += packetLength;
		OSCPacket packet = myConverter.convert(packetBytes, packetLength);
		bundle.addPacket(packet);
	}
	return bundle;
}
 
开发者ID:JanKoehnlein,项目名称:XRobot,代码行数:31,代码来源:OSCByteArrayToJavaConverter.java


示例9: cursorDelete

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
/**
 * Deletes a cursor
 */
private void cursorDelete() {
	
	OSCBundle cursorBundle = new OSCBundle();
	OSCMessage aliveMessage = new OSCMessage("/tuio/2Dcur");
	aliveMessage.addArgument("alive");
	Enumeration<Integer> cursorList = MouseToTUIO.cursorList.keys();
	while (cursorList.hasMoreElements()) {
		Integer s_id = cursorList.nextElement();
		aliveMessage.addArgument(s_id);
	}

	currentFrame++;
	OSCMessage frameMessage = new OSCMessage("/tuio/2Dcur");
	frameMessage.addArgument("fseq");
	frameMessage.addArgument(currentFrame);
	
	cursorBundle.addPacket(aliveMessage);
	cursorBundle.addPacket(frameMessage);

	sendOSC(cursorBundle);
}
 
开发者ID:paluka,项目名称:mouseToTUIO,代码行数:25,代码来源:Simulation.java


示例10: dispatchPacket

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
public void dispatchPacket(OSCPacket packet) {
	if (packet instanceof OSCBundle) {
		dispatchBundle((OSCBundle) packet);
	} else {
		dispatchMessage((OSCMessage) packet);
	}
}
 
开发者ID:gutugutu3030,项目名称:gprintMode,代码行数:8,代码来源:OSCPacketDispatcher.java


示例11: dispatchBundle

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
private void dispatchBundle(OSCBundle bundle) {
	Date timestamp = bundle.getTimestamp();
	OSCPacket[] packets = bundle.getPackets();
	for (OSCPacket packet : packets) {
		dispatchPacket(packet, timestamp);
	}
}
 
开发者ID:gutugutu3030,项目名称:gprintMode,代码行数:8,代码来源:OSCPacketDispatcher.java


示例12: addCursorInfoToBundle

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
/**
 * Adds the cursor info to bundle.
 *
 * @param cursor
 *            the cursor
 * @param bundle
 *            the bundle
 */
private void addCursorInfoToBundle(IndividualCursor cursor, OSCBundle bundle)
{
	OSCMessage setMessage = new OSCMessage("/tuio/2Dcur");
	setMessage.addArgument("set");
	setMessage.addArgument(new Integer(cursor.id));
	setMessage.addArgument(new Float(cursor.x));
	setMessage.addArgument(new Float(cursor.y));
	setMessage.addArgument(new Float(0.0));
	setMessage.addArgument(new Float(0.0));
	setMessage.addArgument(new Float(0.0));
	bundle.addPacket(setMessage);
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:21,代码来源:TableSimTUIOComms.java


示例13: dispatchPacket

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
/**
 * Dispatch packet.
 *
 * @param packet
 *            the packet
 */
public void dispatchPacket(OSCPacket packet)
{
	if (packet instanceof OSCBundle)
	{
		dispatchBundle((OSCBundle) packet);
	}
	else
	{
		dispatchMessage((OSCMessage) packet);
	}
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:18,代码来源:OSCPacketDispatcher.java


示例14: dispatchBundle

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
/**
 * Dispatch bundle.
 *
 * @param bundle
 *            the bundle
 */
private void dispatchBundle(OSCBundle bundle)
{
	Date timestamp = bundle.getTimestamp();
	OSCPacket[] packets = bundle.getPackets();
	for (int i = 0; i < packets.length; i++)
	{
		dispatchPacket(packets[i], timestamp);
	}
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:16,代码来源:OSCPacketDispatcher.java


示例15: dispatchPacket

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
public void dispatchPacket(OSCPacket packet, Date timestamp) {
	if (packet instanceof OSCBundle) {
		dispatchBundle((OSCBundle) packet);
	} else {
		dispatchMessage((OSCMessage) packet, timestamp);
	}
}
 
开发者ID:JanKoehnlein,项目名称:XRobot,代码行数:8,代码来源:OSCPacketDispatcher.java


示例16: dispatchBundle

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
private void dispatchBundle(OSCBundle bundle) {
	Date timestamp = bundle.getTimestamp();
	List<OSCPacket> packets = bundle.getPackets();
	for (OSCPacket packet : packets) {
		dispatchPacket(packet, timestamp);
	}
}
 
开发者ID:JanKoehnlein,项目名称:XRobot,代码行数:8,代码来源:OSCPacketDispatcher.java


示例17: cursorMessage

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
/**
 * Sends a single cursor message
 */
void cursorMessage() {

	OSCBundle cursorBundle = new OSCBundle();
	OSCMessage aliveMessage = new OSCMessage("/tuio/2Dcur");
	aliveMessage.addArgument("alive");
	Enumeration<Integer> cursorList = MouseToTUIO.cursorList.keys();
	while (cursorList.hasMoreElements()) {
		Integer s_id = cursorList.nextElement();
		aliveMessage.addArgument(s_id);

	}

	Finger cursor = selectedCursor;
	if (cursor == null) return;

	Point point = cursor.getPosition();
	float xpos = (point.x)/(float)windowWidth;
	float ypos = (point.y)/(float)windowHeight;
	OSCMessage setMessage = new OSCMessage("/tuio/2Dcur");
	setMessage.addArgument("set");
	setMessage.addArgument(cursor.sessionID);
	setMessage.addArgument(xpos);
	setMessage.addArgument(ypos);
	setMessage.addArgument(cursor.xSpeed);
	setMessage.addArgument(cursor.ySpeed);
	setMessage.addArgument(cursor.mAccel);

	currentFrame++;
	OSCMessage frameMessage = new OSCMessage("/tuio/2Dcur");
	frameMessage.addArgument("fseq");
	frameMessage.addArgument(currentFrame);
	
	cursorBundle.addPacket(aliveMessage);
	cursorBundle.addPacket(setMessage);
	cursorBundle.addPacket(frameMessage);

	sendOSC(cursorBundle);
}
 
开发者ID:paluka,项目名称:mouseToTUIO,代码行数:42,代码来源:Simulation.java


示例18: readTimeTag

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
/**
 * Reads the time tag and convert it to a Java Date object.
 * A timestamp is a 64 bit number representing the time in NTP format.
 * The first 32 bits are seconds since 1900, the second 32 bits are
 * fractions of a second.
 * @return a {@link Date}
 */
private Date readTimeTag() {
	byte[] secondBytes = new byte[8];
	byte[] fractionBytes = new byte[8];
	for (int i = 0; i < 4; i++) {
		// clear the higher order 4 bytes
		secondBytes[i] = 0; fractionBytes[i] = 0;
	}
		// while reading in the seconds & fraction, check if
		// this timetag has immediate semantics
	boolean isImmediate = true;
	for (int i = 4; i < 8; i++) {
		secondBytes[i] = bytes[streamPosition++];
		if (secondBytes[i] > 0) {
			isImmediate = false;
		}
	}
	for (int i = 4; i < 8; i++) {
		fractionBytes[i] = bytes[streamPosition++];
		if (i < 7) {
			if (fractionBytes[i] > 0) {
				isImmediate = false;
			}
		} else {
			if (fractionBytes[i] > 1) {
				isImmediate = false;
			}
		}
	}

	if (isImmediate) {
		return OSCBundle.TIMESTAMP_IMMEDIATE;
	}

	BigInteger secsSince1900 = new BigInteger(secondBytes);
	long secsSince1970 =  secsSince1900.longValue()
			- OSCBundle.SECONDS_FROM_1900_TO_1970.longValue();

	// no point maintaining times in the distant past
	if (secsSince1970 < 0) {
		secsSince1970 = 0;
	}
	long fraction = (new BigInteger(fractionBytes).longValue());

	// this line was cribbed from jakarta commons-net's NTP TimeStamp code
	fraction = (fraction * 1000) / 0x100000000L;

	// I do not know where, but I'm losing 1ms somewhere...
	fraction = (fraction > 0) ? fraction + 1 : 0;
	long millisecs = (secsSince1970 * 1000) + fraction;
	return new Date(millisecs);
}
 
开发者ID:gutugutu3030,项目名称:gprintMode,代码行数:59,代码来源:OSCByteArrayToJavaConverter.java


示例19: sendTUIOdata

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
/**
 * Sends the TUIO Data
 * @param blobList
 */
public void sendTUIOdata () throws ArrayIndexOutOfBoundsException {

	OSCBundle oscBundle = new OSCBundle();

	/*
	 * SOURCE Message
	 */
	Object outputData[] = new Object[2];
	outputData[0] = "source";
	outputData[1] = sourceName;
	//oscInterface.printOSCData(new OSCMessage("/tuio/2Dcur", outputData));
	oscBundle.addPacket(new OSCMessage("/tuio/2Dcur", outputData));
	
	/*
	 * ALIVE Message
	 */
	outputData = new Object[tuioPoints.size() + 1];
	outputData[0] = "alive";

	for (int i = 0; i < tuioPoints.size(); i++) {
		outputData[1 + i] = (Integer)tuioPoints.get(i).getSessionId(); // ID
	}

	//oscInterface.printOSCData(new OSCMessage("/tuio/2Dcur", outputData));
	oscBundle.addPacket(new OSCMessage("/tuio/2Dcur", outputData));

	
	/*
	 * SET Message
	 */
	for (int i = 0; i < tuioPoints.size(); i++) {

		outputData = new Object[7];

		outputData[0] = "set";
		outputData[1] = (Integer) tuioPoints.get(i).getSessionId(); // ID

		outputData[2] = (Float) tuioPoints.get(i).getX(); // x KOORD
		outputData[3] = (Float) tuioPoints.get(i).getY(); // y KOORD

		outputData[4] = (Float) tuioPoints.get(i).getXVel(); // Velocity Vector X
		outputData[5] = (Float) tuioPoints.get(i).getYVel(); // Velocity Vector Y

		outputData[6] = (Float) tuioPoints.get(i).getAccel(); // Acceleration

		//oscInterface.printOSCData(new OSCMessage("/tuio/2Dcur", outputData));
		oscBundle.addPacket(new OSCMessage("/tuio/2Dcur", outputData));
	}

	
	/*
	 * FSEQ Message
	 */
	outputData = new Object[2];
	outputData[0] = (String) "fseq";
	outputData[1] = (Integer) counter_fseq;
	counter_fseq++;

	//oscInterface.printOSCData(new OSCMessage("/tuio/2Dcur", outputData));
	oscBundle.addPacket(new OSCMessage("/tuio/2Dcur", outputData));

	/*
	 * Sending bundle
	 */
	oscInterface.sendOSCBundle(oscBundle);
}
 
开发者ID:TobiasSchwirten,项目名称:tuiodroid,代码行数:71,代码来源:TouchView.java


示例20: readTimeTag

import com.illposed.osc.OSCBundle; //导入依赖的package包/类
/**
 * Reads the time tag and convert it to a Java Date object.
 * A timestamp is a 64 bit number representing the time in NTP format.
 * The first 32 bits are seconds since 1900, the second 32 bits are
 * fractions of a second.
 * @return a {@link Date}
 */
private Date readTimeTag() {
	byte[] secondBytes = new byte[8];
	byte[] fractionBytes = new byte[8];
	for (int i = 0; i < 4; i++) {
		// clear the higher order 4 bytes
		secondBytes[i] = 0;
		fractionBytes[i] = 0;
	}
	// while reading in the seconds & fraction, check if
	// this timetag has immediate semantics
	boolean isImmediate = true;
	for (int i = 4; i < 8; i++) {
		secondBytes[i] = bytes[streamPosition++];
		if (secondBytes[i] > 0) {
			isImmediate = false;
		}
	}
	for (int i = 4; i < 8; i++) {
		fractionBytes[i] = bytes[streamPosition++];
		if (i < 7) {
			if (fractionBytes[i] > 0) {
				isImmediate = false;
			}
		} else {
			if (fractionBytes[i] > 1) {
				isImmediate = false;
			}
		}
	}

	if (isImmediate) {
		return OSCBundle.TIMESTAMP_IMMEDIATE;
	}

	final long secsSince1900 = new BigInteger(secondBytes).longValue();
	long secsSince1970 = secsSince1900 - OSCBundle.SECONDS_FROM_1900_TO_1970;

	// no point maintaining times in the distant past
	if (secsSince1970 < 0) {
		secsSince1970 = 0;
	}
	long fraction = (new BigInteger(fractionBytes).longValue());

	// this line was cribbed from jakarta commons-net's NTP TimeStamp code
	fraction = (fraction * 1000) / 0x100000000L;

	// I do not know where, but I'm losing 1ms somewhere...
	fraction = (fraction > 0) ? fraction + 1 : 0;
	long millisecs = (secsSince1970 * 1000) + fraction;
	return new Date(millisecs);
}
 
开发者ID:JanKoehnlein,项目名称:XRobot,代码行数:59,代码来源:OSCByteArrayToJavaConverter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BranchRateModel类代码示例发布时间:2022-05-23
下一篇:
Java InputConnection类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap