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


Java OSCMessage类代码示例

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


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

示例1: dispatchMessage

import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
 * Dispatch message.
 *
 * @param message
 *            the message
 * @param time
 *            the time
 */
private void dispatchMessage(OSCMessage message, Date time)
{
	Enumeration<String> keys = addressToClassTable.keys();
	while (keys.hasMoreElements())
	{
		String key = keys.nextElement();
		// this supports the OSC regexp facility, but it
		// only works in JDK 1.4, so don't support it right now
		// if (key.matches(message.getAddress())) {
		if (key.equals(message.getAddress()))
		{
			OSCListener listener = addressToClassTable.get(key);
			listener.acceptMessage(time, message);
		}
	}
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:25,代码来源:OSCPacketDispatcher.java

示例2: convertMessage

import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
 * Converts the byte array to a simple message.
 * Assumes that the byte array is a message.
 * @return a message containing the data specified in the byte stream
 */
private OSCMessage convertMessage() {
	OSCMessage message = new OSCMessage();
	message.setAddress(readString());
	List<Character> types = readTypes();
	if (null == types) {
		// we are done
		return message;
	}
	moveToFourByteBoundry();
	for (int i = 0; i < types.size(); ++i) {
		if ('[' == types.get(i).charValue()) {
			// we're looking at an array -- read it in
			message.addArgument(readArray(types, ++i).toArray());
			// then increment i to the end of the array
			while (types.get(i).charValue() != ']') {
				i++;
			}
		} else {
			message.addArgument(readArgument(types.get(i)));
		}
	}
	return message;
}
 
开发者ID:gutugutu3030,项目名称:gprintMode,代码行数:29,代码来源:OSCByteArrayToJavaConverter.java

示例3: addListener

import com.illposed.osc.OSCMessage; //导入依赖的package包/类
@Override
public void addListener(String source, PdListener listener) {
	Array<PdListener> listeners = this.listeners.get(source);
	if(listeners == null){
		Collection<Object> args = new ArrayList<Object>();
		args.add(1);
		OSCMessage msg = new OSCMessage("/subscribe/" + source, args);
		try {
			sender.send(msg);
		} catch (IOException e) {
			throw new PdRuntimeException(e);
		}
		this.listeners.put(source, listeners = new Array<PdListener>());
	}
	listeners.add(listener);
}
 
开发者ID:mgsx-dev,项目名称:gdx-pd,代码行数:17,代码来源:PdAudioRemote.java

示例4: cursorDelete

import com.illposed.osc.OSCMessage; //导入依赖的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

示例5: multiCursorMessage

import com.illposed.osc.OSCMessage; //导入依赖的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

示例6: reset

import com.illposed.osc.OSCMessage; //导入依赖的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

示例7: singleCursorMessage

import com.illposed.osc.OSCMessage; //导入依赖的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

示例8: testSettingLabelOnWithOSC

import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
 * Testing /togN/labelOn
 */
public void testSettingLabelOnWithOSC() throws IOException {
    ToggleOSCWrapper tog = getActivity().getToggleWrappers().get(0);
    assertEquals("Initially toggle on label should be set by config", "tog_on1", tog.getOnLabel());

    final CountDownLatch signal = new CountDownLatch(1);

    final Collection<Object> args = new ArrayList<Object>();
    args.add("hello");
    args.add("world");

    mOscOut.send(new OSCMessage("/tog1/labelOn", args));
    try {
        signal.await(2, TimeUnit.SECONDS);
    } catch (Exception e) {
        e.printStackTrace();
    }

    assertEquals("tog labelOn should be set by OSC", "hello world", tog.getOnLabel());
}
 
开发者ID:ahmetkizilay,项目名称:QuickOSC-as,代码行数:23,代码来源:QuickOSCToggleOSCTesting.java

示例9: testSettingLabelOffWithOSC

import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
 * Testing /togN/labelOff
 */
public void testSettingLabelOffWithOSC() throws IOException {
    ToggleOSCWrapper tog = getActivity().getToggleWrappers().get(0);
    assertEquals("Initially toggle off label should be set by config", "tog_off1", tog.getOffLabel());

    final CountDownLatch signal = new CountDownLatch(1);

    final Collection<Object> args = new ArrayList<Object>();
    args.add("hello");
    args.add("world");

    mOscOut.send(new OSCMessage("/tog1/labelOff", args));
    try {
        signal.await(2, TimeUnit.SECONDS);
    } catch (Exception e) {
        e.printStackTrace();
    }

    assertEquals("tog labelOff should be set by OSC", "hello world", tog.getOffLabel());
}
 
开发者ID:ahmetkizilay,项目名称:QuickOSC-as,代码行数:23,代码来源:QuickOSCToggleOSCTesting.java

示例10: testSettingToggledOnMsgWithOSC

import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
 * Testing /togN/msgToggledOn
 */
public void testSettingToggledOnMsgWithOSC() throws IOException {
    ToggleOSCWrapper tog = getActivity().getToggleWrappers().get(0);
    assertEquals("Initially toggle msgToggledOn value should be set by config", "/tog1/1", tog.getMessageToggleOnRaw());

    final CountDownLatch signal = new CountDownLatch(1);

    final Collection<Object> args = new ArrayList<Object>();
    args.add("/hello");
    args.add("world");

    mOscOut.send(new OSCMessage("/tog1/msgToggledOn", args));
    try {
        signal.await(2, TimeUnit.SECONDS);
    } catch (Exception e) {
        e.printStackTrace();
    }

    assertEquals("tog msgToggledOn value should be set by OSC", "/hello world", tog.getMessageToggleOnRaw());
}
 
开发者ID:ahmetkizilay,项目名称:QuickOSC-as,代码行数:23,代码来源:QuickOSCToggleOSCTesting.java

示例11: testSettingToggledOffMsgWithOSC

import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
 * Testing /togN/msgToggledOff
 */
public void testSettingToggledOffMsgWithOSC() throws IOException {
    ToggleOSCWrapper tog = getActivity().getToggleWrappers().get(0);
    assertEquals("toggle msgToggledOff value should be set by config", "/tog1/0", tog.getMessageToggleOffRaw());

    final CountDownLatch signal = new CountDownLatch(1);

    final Collection<Object> args = new ArrayList<Object>();
    args.add("/hello");
    args.add("world");

    mOscOut.send(new OSCMessage("/tog1/msgToggledOff", args));
    try {
        signal.await(2, TimeUnit.SECONDS);
    } catch (Exception e) {
        e.printStackTrace();
    }

    assertEquals("tog msgToggledOff value should be set by OSC", "/hello world", tog.getMessageToggleOffRaw());
}
 
开发者ID:ahmetkizilay,项目名称:QuickOSC-as,代码行数:23,代码来源:QuickOSCToggleOSCTesting.java

示例12: testSetButtonLabelWithOSC

import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
 * Testing /btnN/label OSC message
 * @throws Throwable
 */
public void testSetButtonLabelWithOSC() throws Throwable {
    final CountDownLatch signal = new CountDownLatch(1);

    final Collection<Object> args = new ArrayList<Object>();
    args.add("hello");

    new AsyncSendOSCTask(getActivity(), QuickOSCMessageReceiveTests.this.mOscOut).execute(new OSCMessage("/btn1/label", args));

    try {

        signal.await(2, TimeUnit.SECONDS);
    } catch (Exception e) {
        e.printStackTrace();
    }

    Button btn1 = (Button) getActivity().findViewById(R.id.button1);
    assertEquals("btn1 text should be", "hello", btn1.getText().toString());
}
 
开发者ID:ahmetkizilay,项目名称:QuickOSC-as,代码行数:23,代码来源:QuickOSCMessageReceiveTests.java

示例13: testSetToggleOffLabelWithOSC

import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
 * Testing /togN/labelOff OSC message
 * @throws Throwable
 */
public void testSetToggleOffLabelWithOSC() throws Throwable {
    final CountDownLatch signal = new CountDownLatch(1);

    final Collection<Object> args = new ArrayList<Object>();
    args.add("hello");

    new AsyncSendOSCTask(getActivity(), QuickOSCMessageReceiveTests.this.mOscOut).execute(new OSCMessage("/tog1/labelOff", args));

    try {
        signal.await(2, TimeUnit.SECONDS);
    } catch (Exception e) {
        e.printStackTrace();
    }

    ToggleButton btn1 = (ToggleButton) getActivity().findViewById(R.id.toggleButton1);
    assertEquals("tog1 off should be", "hello", btn1.getTextOff().toString());
}
 
开发者ID:ahmetkizilay,项目名称:QuickOSC-as,代码行数:22,代码来源:QuickOSCMessageReceiveTests.java

示例14: testSetToggleOnStateWithOSC

import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
 * Testing /togN/labelOn OSC message
 * @throws Throwable
 */
public void testSetToggleOnStateWithOSC() throws Throwable {
    final CountDownLatch signal = new CountDownLatch(1);

    final Collection<Object> args = new ArrayList<Object>();
    args.add(1);

    new AsyncSendOSCTask(getActivity(), QuickOSCMessageReceiveTests.this.mOscOut).execute(new OSCMessage("/tog1/value", args));

    try {
        signal.await(2, TimeUnit.SECONDS);
    } catch (Exception e) {
        e.printStackTrace();
    }

    ToggleButton btn1 = (ToggleButton) getActivity().findViewById(R.id.toggleButton1);
    assertTrue("tog1 should be on", btn1.isChecked());
}
 
开发者ID:ahmetkizilay,项目名称:QuickOSC-as,代码行数:22,代码来源:QuickOSCMessageReceiveTests.java

示例15: testSetToggleStateOffWithOSC

import com.illposed.osc.OSCMessage; //导入依赖的package包/类
/**
 * Testing /togN/value 0
 * @throws Throwable
 */
public void testSetToggleStateOffWithOSC() throws Throwable {
    final CountDownLatch signal = new CountDownLatch(1);

    final Collection<Object> args = new ArrayList<Object>();
    args.add(0);

    new AsyncSendOSCTask(getActivity(), QuickOSCMessageReceiveTests.this.mOscOut).execute(new OSCMessage("/tog1/value", args));

    try {
        signal.await(2, TimeUnit.SECONDS);
    } catch (Exception e) {
        e.printStackTrace();
    }

    ToggleButton btn1 = (ToggleButton) getActivity().findViewById(R.id.toggleButton1);
    assertFalse("tog1 should be off", btn1.isChecked());
}
 
开发者ID:ahmetkizilay,项目名称:QuickOSC-as,代码行数:22,代码来源:QuickOSCMessageReceiveTests.java


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