Permalink
Browse files

1) Reorganized some sections a bit in Processing master.

2) Added in oscP5 library for some future work.
  • Loading branch information...
1 parent 461a888 commit 9a56b94eb90c76d337605d2b40056a79b7e7f9c1 Chris Hodapp committed Oct 9, 2011
Showing with 33,482 additions and 74 deletions.
  1. +73 −0 shiftbrite_master/libraries/oscP5/examples/oscP5broadcastClient/oscP5broadcastClient.pde
  2. +27 −0 shiftbrite_master/libraries/oscP5/examples/oscP5broadcastTester/oscP5broadcastTester.pde
  3. +73 −0 shiftbrite_master/libraries/oscP5/examples/oscP5broadcaster/oscP5broadcaster.pde
  4. +69 −0 shiftbrite_master/libraries/oscP5/examples/oscP5bundle/oscP5bundle.pde
  5. +38 −0 shiftbrite_master/libraries/oscP5/examples/oscP5flush/oscP5flush.pde
  6. +55 −0 shiftbrite_master/libraries/oscP5/examples/oscP5message/oscP5message.pde
  7. +51 −0 shiftbrite_master/libraries/oscP5/examples/oscP5multicast/oscP5multicast.pde
  8. +45 −0 shiftbrite_master/libraries/oscP5/examples/oscP5oscArgument/oscP5oscArgument.pde
  9. +65 −0 shiftbrite_master/libraries/oscP5/examples/oscP5parsing/oscP5parsing.pde
  10. +82 −0 shiftbrite_master/libraries/oscP5/examples/oscP5plug/oscP5plug.pde
  11. +72 −0 shiftbrite_master/libraries/oscP5/examples/oscP5properties/oscP5properties.pde
  12. +51 −0 shiftbrite_master/libraries/oscP5/examples/oscP5sendReceive/oscP5sendReceive.pde
  13. +59 −0 shiftbrite_master/libraries/oscP5/examples/oscP5tcp/oscP5tcp.pde
  14. BIN shiftbrite_master/libraries/oscP5/library/oscP5.jar
  15. +99 −0 shiftbrite_master/libraries/oscP5/reference/allclasses-frame.html
  16. +99 −0 shiftbrite_master/libraries/oscP5/reference/allclasses-noframe.html
  17. +446 −0 shiftbrite_master/libraries/oscP5/reference/constant-values.html
  18. +214 −0 shiftbrite_master/libraries/oscP5/reference/deprecated-list.html
  19. +217 −0 shiftbrite_master/libraries/oscP5/reference/help-doc.html
  20. +1,693 −0 shiftbrite_master/libraries/oscP5/reference/index-all.html
  21. +39 −0 shiftbrite_master/libraries/oscP5/reference/index.html
  22. +560 −0 shiftbrite_master/libraries/oscP5/reference/netP5/AbstractMulticast.html
  23. +869 −0 shiftbrite_master/libraries/oscP5/reference/netP5/AbstractTcpClient.html
  24. +675 −0 shiftbrite_master/libraries/oscP5/reference/netP5/AbstractTcpServer.html
  25. +408 −0 shiftbrite_master/libraries/oscP5/reference/netP5/AbstractUdpClient.html
  26. +440 −0 shiftbrite_master/libraries/oscP5/reference/netP5/AbstractUdpServer.html
  27. +906 −0 shiftbrite_master/libraries/oscP5/reference/netP5/Bytes.html
  28. +613 −0 shiftbrite_master/libraries/oscP5/reference/netP5/Logger.html
  29. +428 −0 shiftbrite_master/libraries/oscP5/reference/netP5/Multicast.html
  30. +422 −0 shiftbrite_master/libraries/oscP5/reference/netP5/NetAddress.html
  31. +460 −0 shiftbrite_master/libraries/oscP5/reference/netP5/NetAddressList.html
  32. +334 −0 shiftbrite_master/libraries/oscP5/reference/netP5/NetInfo.html
  33. +223 −0 shiftbrite_master/libraries/oscP5/reference/netP5/NetListener.html
  34. +386 −0 shiftbrite_master/libraries/oscP5/reference/netP5/NetMessage.html
  35. +274 −0 shiftbrite_master/libraries/oscP5/reference/netP5/NetP5.html
  36. +434 −0 shiftbrite_master/libraries/oscP5/reference/netP5/NetStatus.html
  37. +1,008 −0 shiftbrite_master/libraries/oscP5/reference/netP5/StringUtils.html
  38. +473 −0 shiftbrite_master/libraries/oscP5/reference/netP5/TcpClient.html
  39. +311 −0 shiftbrite_master/libraries/oscP5/reference/netP5/TcpPacket.html
  40. +247 −0 shiftbrite_master/libraries/oscP5/reference/netP5/TcpPacketListener.html
  41. +463 −0 shiftbrite_master/libraries/oscP5/reference/netP5/TcpServer.html
  42. +266 −0 shiftbrite_master/libraries/oscP5/reference/netP5/UdpClient.html
  43. +213 −0 shiftbrite_master/libraries/oscP5/reference/netP5/UdpPacketListener.html
  44. +411 −0 shiftbrite_master/libraries/oscP5/reference/netP5/UdpServer.html
  45. +85 −0 shiftbrite_master/libraries/oscP5/reference/netP5/package-frame.html
  46. +255 −0 shiftbrite_master/libraries/oscP5/reference/netP5/package-summary.html
  47. +172 −0 shiftbrite_master/libraries/oscP5/reference/netP5/package-tree.html
  48. +1,160 −0 shiftbrite_master/libraries/oscP5/reference/oscP5/OscArgument.html
  49. +765 −0 shiftbrite_master/libraries/oscP5/reference/oscP5/OscBundle.html
  50. +223 −0 shiftbrite_master/libraries/oscP5/reference/oscP5/OscEventListener.html
  51. +431 −0 shiftbrite_master/libraries/oscP5/reference/oscP5/OscIn.html
  52. +1,447 −0 shiftbrite_master/libraries/oscP5/reference/oscP5/OscMessage.html
  53. +760 −0 shiftbrite_master/libraries/oscP5/reference/oscP5/OscNetManager.html
  54. +1,858 −0 shiftbrite_master/libraries/oscP5/reference/oscP5/OscP5.html
  55. +357 −0 shiftbrite_master/libraries/oscP5/reference/oscP5/OscPacket.html
  56. +192 −0 shiftbrite_master/libraries/oscP5/reference/oscP5/OscPatcher.html
  57. +393 −0 shiftbrite_master/libraries/oscP5/reference/oscP5/OscPlug.html
  58. +799 −0 shiftbrite_master/libraries/oscP5/reference/oscP5/OscProperties.html
  59. +448 −0 shiftbrite_master/libraries/oscP5/reference/oscP5/OscStatus.html
  60. +63 −0 shiftbrite_master/libraries/oscP5/reference/oscP5/package-frame.html
  61. +210 −0 shiftbrite_master/libraries/oscP5/reference/oscP5/package-summary.html
  62. +164 −0 shiftbrite_master/libraries/oscP5/reference/oscP5/package-tree.html
  63. +44 −0 shiftbrite_master/libraries/oscP5/reference/overview-frame.html
  64. +158 −0 shiftbrite_master/libraries/oscP5/reference/overview-summary.html
  65. +179 −0 shiftbrite_master/libraries/oscP5/reference/overview-tree.html
  66. +2 −0 shiftbrite_master/libraries/oscP5/reference/package-list
  67. BIN shiftbrite_master/libraries/oscP5/reference/resources/inherit.gif
  68. +310 −0 shiftbrite_master/libraries/oscP5/reference/stylesheet.css
  69. +337 −0 shiftbrite_master/libraries/oscP5/src/netP5/AbstractMulticast.java
  70. +491 −0 shiftbrite_master/libraries/oscP5/src/netP5/AbstractTcpClient.java
  71. +317 −0 shiftbrite_master/libraries/oscP5/src/netP5/AbstractTcpServer.java
  72. +199 −0 shiftbrite_master/libraries/oscP5/src/netP5/AbstractUdpClient.java
  73. +271 −0 shiftbrite_master/libraries/oscP5/src/netP5/AbstractUdpServer.java
  74. +470 −0 shiftbrite_master/libraries/oscP5/src/netP5/Bytes.java
  75. +153 −0 shiftbrite_master/libraries/oscP5/src/netP5/Logger.java
  76. +116 −0 shiftbrite_master/libraries/oscP5/src/netP5/Multicast.java
  77. +130 −0 shiftbrite_master/libraries/oscP5/src/netP5/NetAddress.java
  78. +169 −0 shiftbrite_master/libraries/oscP5/src/netP5/NetAddressList.java
  79. +154 −0 shiftbrite_master/libraries/oscP5/src/netP5/NetInfo.java
  80. +34 −0 shiftbrite_master/libraries/oscP5/src/netP5/NetListener.java
  81. +148 −0 shiftbrite_master/libraries/oscP5/src/netP5/NetMessage.java
  82. +55 −0 shiftbrite_master/libraries/oscP5/src/netP5/NetP5.java
  83. +222 −0 shiftbrite_master/libraries/oscP5/src/netP5/NetPlug.java
  84. +65 −0 shiftbrite_master/libraries/oscP5/src/netP5/NetStatus.java
  85. +705 −0 shiftbrite_master/libraries/oscP5/src/netP5/StringUtils.java
  86. +214 −0 shiftbrite_master/libraries/oscP5/src/netP5/TcpClient.java
  87. +67 −0 shiftbrite_master/libraries/oscP5/src/netP5/TcpPacket.java
  88. +38 −0 shiftbrite_master/libraries/oscP5/src/netP5/TcpPacketListener.java
  89. +177 −0 shiftbrite_master/libraries/oscP5/src/netP5/TcpServer.java
  90. +49 −0 shiftbrite_master/libraries/oscP5/src/netP5/UdpClient.java
  91. +41 −0 shiftbrite_master/libraries/oscP5/src/netP5/UdpPacketListener.java
  92. +151 −0 shiftbrite_master/libraries/oscP5/src/netP5/UdpServer.java
  93. +228 −0 shiftbrite_master/libraries/oscP5/src/oscP5/OscArgument.java
  94. +189 −0 shiftbrite_master/libraries/oscP5/src/oscP5/OscBundle.java
  95. +38 −0 shiftbrite_master/libraries/oscP5/src/oscP5/OscEventListener.java
  96. +97 −0 shiftbrite_master/libraries/oscP5/src/oscP5/OscIn.java
  97. +745 −0 shiftbrite_master/libraries/oscP5/src/oscP5/OscMessage.java
  98. +386 −0 shiftbrite_master/libraries/oscP5/src/oscP5/OscNetManager.java
  99. +1,025 −0 shiftbrite_master/libraries/oscP5/src/oscP5/OscP5.java
  100. +143 −0 shiftbrite_master/libraries/oscP5/src/oscP5/OscPacket.java
  101. +243 −0 shiftbrite_master/libraries/oscP5/src/oscP5/OscPatcher.java
  102. +258 −0 shiftbrite_master/libraries/oscP5/src/oscP5/OscPlug.java
  103. +319 −0 shiftbrite_master/libraries/oscP5/src/oscP5/OscProperties.java
  104. +63 −0 shiftbrite_master/libraries/oscP5/src/oscP5/OscStatus.java
  105. +109 −74 shiftbrite_master/shiftbrite_master_processing/shiftbrite_master_processing.pde
@@ -0,0 +1,73 @@
+/**
+ * oscP5broadcastClient by andreas schlegel
+ * an osc broadcast client.
+ * an example for broadcast server is located in the oscP5broadcaster exmaple.
+ * oscP5 website at http://www.sojamo.de/oscP5
+ */
+
+import oscP5.*;
+import netP5.*;
+
+
+OscP5 oscP5;
+
+/* a NetAddress contains the ip address and port number of a remote location in the network. */
+NetAddress myBroadcastLocation;
+
+void setup() {
+ size(400,400);
+ frameRate(25);
+
+ /* create a new instance of oscP5.
+ * 12000 is the port number you are listening for incoming osc messages.
+ */
+ oscP5 = new OscP5(this,12000);
+
+ /* create a new NetAddress. a NetAddress is used when sending osc messages
+ * with the oscP5.send method.
+ */
+
+ /* the address of the osc broadcast server */
+ myBroadcastLocation = new NetAddress("127.0.0.1",32000);
+}
+
+
+void draw() {
+ background(0);
+}
+
+
+void mousePressed() {
+ /* create a new OscMessage with an address pattern, in this case /test. */
+ OscMessage myOscMessage = new OscMessage("/test");
+ /* add a value (an integer) to the OscMessage */
+ myOscMessage.add(100);
+ /* send the OscMessage to a remote location specified in myNetAddress */
+ oscP5.send(myOscMessage, myBroadcastLocation);
+}
+
+
+void keyPressed() {
+ OscMessage m;
+ switch(key) {
+ case('c'):
+ /* connect to the broadcaster */
+ m = new OscMessage("/server/connect",new Object[0]);
+ oscP5.flush(m,myBroadcastLocation);
+ break;
+ case('d'):
+ /* disconnect from the broadcaster */
+ m = new OscMessage("/server/disconnect",new Object[0]);
+ oscP5.flush(m,myBroadcastLocation);
+ break;
+
+ }
+}
+
+
+/* incoming osc message are forwarded to the oscEvent method. */
+void oscEvent(OscMessage theOscMessage) {
+ /* get and print the address pattern and the typetag of the received OscMessage */
+ println("### received an osc message with addrpattern "+theOscMessage.addrPattern()+" and typetag "+theOscMessage.typetag());
+ theOscMessage.print();
+}
@@ -0,0 +1,27 @@
+import controlP5.*;
+
+
+ControlP5 controlP5;
+
+int myColorBackground = color(0,0,0);
+
+int knobValue = 100;
+
+void setup() {
+ size(400,400);
+ smooth();
+ controlP5 = new ControlP5(this);
+ controlP5.addKnob("knob",100,200,128,100,160,40);
+ controlP5.addKnob("knobValue",0,255,128,100,240,40);
+}
+
+void draw() {
+ background(myColorBackground);
+ fill(knobValue);
+ rect(0,0,width,100);
+}
+
+void knob(int theColor) {
+ myColorBackground = color(theColor);
+ println("a knob event. setting background to "+theColor);
+}
@@ -0,0 +1,73 @@
+/**
+ * oscP5broadcaster by andreas schlegel
+ * an osc broadcast server.
+ * osc clients can connect to the server by sending a connect and
+ * disconnect osc message as defined below to the server.
+ * incoming messages at the server will then be broadcasted to
+ * all connected clients.
+ * an example for a client is located in the oscP5broadcastClient exmaple.
+ * oscP5 website at http://www.sojamo.de/oscP5
+ */
+
+import oscP5.*;
+import netP5.*;
+
+OscP5 oscP5;
+NetAddressList myNetAddressList = new NetAddressList();
+/* listeningPort is the port the server is listening for incoming messages */
+int myListeningPort = 32000;
+/* the broadcast port is the port the clients should listen for incoming messages from the server*/
+int myBroadcastPort = 12000;
+
+String myConnectPattern = "/server/connect";
+String myDisconnectPattern = "/server/disconnect";
+
+
+void setup() {
+ oscP5 = new OscP5(this, myListeningPort);
+ frameRate(25);
+}
+
+void draw() {
+ background(0);
+}
+
+void oscEvent(OscMessage theOscMessage) {
+ /* check if the address pattern fits any of our patterns */
+ if (theOscMessage.addrPattern().equals(myConnectPattern)) {
+ connect(theOscMessage.netAddress().address());
+ }
+ else if (theOscMessage.addrPattern().equals(myDisconnectPattern)) {
+ disconnect(theOscMessage.netAddress().address());
+ }
+ /**
+ * if pattern matching was not successful, then broadcast the incoming
+ * message to all addresses in the netAddresList.
+ */
+ else {
+ oscP5.send(theOscMessage, myNetAddressList);
+ }
+}
+
+
+ private void connect(String theIPaddress) {
+ if (!myNetAddressList.contains(theIPaddress, myBroadcastPort)) {
+ myNetAddressList.add(new NetAddress(theIPaddress, myBroadcastPort));
+ println("### adding "+theIPaddress+" to the list.");
+ } else {
+ println("### "+theIPaddress+" is already connected.");
+ }
+ println("### currently there are "+myNetAddressList.list().size()+" remote locations connected.");
+ }
+
+
+
+private void disconnect(String theIPaddress) {
+if (myNetAddressList.contains(theIPaddress, myBroadcastPort)) {
+ myNetAddressList.remove(theIPaddress, myBroadcastPort);
+ println("### removing "+theIPaddress+" from the list.");
+ } else {
+ println("### "+theIPaddress+" is not connected.");
+ }
+ println("### currently there are "+myNetAddressList.list().size());
+ }
@@ -0,0 +1,69 @@
+/**
+ * oscP5bundle by andreas schlegel
+ * an osc broadcast server.
+ * example shows how to create and send osc bundles.
+ * oscP5 website at http://www.sojamo.de/oscP5
+ */
+
+import oscP5.*;
+import netP5.*;
+
+OscP5 oscP5;
+NetAddress myRemoteLocation;
+
+void setup() {
+ size(400,400);
+ frameRate(25);
+ /* start oscP5, listening for incoming messages at port 12000 */
+ oscP5 = new OscP5(this,12000);
+
+ /* myRemoteLocation is a NetAddress. a NetAddress takes 2 parameters,
+ * an ip address and a port number. myRemoteLocation is used as parameter in
+ * oscP5.send() when sending osc packets to another computer, device,
+ * application. usage see below. for testing purposes the listening port
+ * and the port of the remote location address are the same, hence you will
+ * send messages back to this sketch.
+ */
+ myRemoteLocation = new NetAddress("127.0.0.1",12000);
+}
+
+
+void draw() {
+ background(0);
+}
+
+
+void mousePressed() {
+ /* create an osc bundle */
+ OscBundle myBundle = new OscBundle();
+
+ /* createa new osc message object */
+ OscMessage myMessage = new OscMessage("/test");
+ myMessage.add("abc");
+
+ /* add an osc message to the osc bundle */
+ myBundle.add(myMessage);
+
+ /* reset and clear the myMessage object for refill. */
+ myMessage.clear();
+
+ /* refill the osc message object again */
+ myMessage.setAddrPattern("/test2");
+ myMessage.add("defg");
+ myBundle.add(myMessage);
+
+ myBundle.setTimetag(myBundle.now() + 10000);
+ /* send the osc bundle, containing 2 osc messages, to a remote location. */
+ oscP5.send(myBundle, myRemoteLocation);
+}
+
+
+
+/* incoming osc message are forwarded to the oscEvent method. */
+void oscEvent(OscMessage theOscMessage) {
+ /* print the address pattern and the typetag of the received OscMessage */
+ print("### received an osc message.");
+ print(" addrpattern: "+theOscMessage.addrPattern());
+ print(" typetag: "+theOscMessage.typetag());
+ println(" timetag: "+theOscMessage.timetag());
+}
@@ -0,0 +1,38 @@
+ /**
+ * oscP5flush by andreas schlegel
+ * example shows how to send osc messages without having to instantiate an oscP5 object.
+ * this can be useful if you are not listening for incoming messages and you
+ * want to avoid to have the additional oscP5 thread running listening for incoming
+ * message (which you wont need if you are only sending messages).
+ * oscP5 website at http://www.sojamo.de/oscP5
+ */
+
+import oscP5.*;
+import netP5.*;
+
+
+NetAddress myRemoteLocation;
+void setup() {
+ size(400,400);
+ frameRate(25);
+ /* set up a remote location */
+ myRemoteLocation = new NetAddress("127.0.0.1",12000);
+}
+
+
+void draw() {
+ background(0);
+}
+
+
+void mousePressed() {
+ /* create a new OscMessage with an address pattern, in this case /test. */
+ OscMessage myOscMessage = new OscMessage("/test");
+
+ /* add a value (an integer) to the OscMessage */
+ myOscMessage.add(100);
+
+ /* send the OscMessage to the remote location.
+ */
+ OscP5.flush(myOscMessage,myRemoteLocation);
+}
@@ -0,0 +1,55 @@
+/**
+ * oscP5message by andreas schlegel
+ * example shows how to create osc messages.
+ * oscP5 website at http://www.sojamo.de/oscP5
+ */
+
+import oscP5.*;
+import netP5.*;
+
+OscP5 oscP5;
+NetAddress myRemoteLocation;
+
+void setup() {
+ size(400,400);
+ frameRate(25);
+ /* start oscP5, listening for incoming messages at port 12000 */
+ oscP5 = new OscP5(this,12000);
+
+ /* myRemoteLocation is a NetAddress. a NetAddress takes 2 parameters,
+ * an ip address and a port number. myRemoteLocation is used as parameter in
+ * oscP5.send() when sending osc packets to another computer, device,
+ * application. usage see below. for testing purposes the listening port
+ * and the port of the remote location address are the same, hence you will
+ * send messages back to this sketch.
+ */
+ myRemoteLocation = new NetAddress("127.0.0.1",12000);
+}
+
+
+void draw() {
+ background(0);
+}
+
+void mousePressed() {
+ /* in the following different ways of creating osc messages are shown by example */
+ OscMessage myMessage = new OscMessage("/test");
+
+ myMessage.add(123); /* add an int to the osc message */
+ myMessage.add(12.34); /* add a float to the osc message */
+ myMessage.add("some text"); /* add a string to the osc message */
+ myMessage.add(new byte[] {0x00, 0x01, 0x10, 0x20}); /* add a byte blob to the osc message */
+ myMessage.add(new int[] {1,2,3,4}); /* add an int array to the osc message */
+
+ /* send the message */
+ oscP5.send(myMessage, myRemoteLocation);
+}
+
+
+/* incoming osc message are forwarded to the oscEvent method. */
+void oscEvent(OscMessage theOscMessage) {
+ /* print the address pattern and the typetag of the received OscMessage */
+ print("### received an osc message.");
+ print(" addrpattern: "+theOscMessage.addrPattern());
+ println(" typetag: "+theOscMessage.typetag());
+}
@@ -0,0 +1,51 @@
+/**
+ * oscP5multicast by andreas schlegel
+ * example shows how to send osc via a multicast socket.
+ * what is a multicast? http://en.wikipedia.org/wiki/Multicast
+ * ip multicast ranges and uses:
+ * 224.0.0.0 - 224.0.0.255 Reserved for special Òwell-knownÓ multicast addresses.
+ * 224.0.1.0 - 238.255.255.255 Globally-scoped (Internet-wide) multicast addresses.
+ * 239.0.0.0 - 239.255.255.255 Administratively-scoped (local) multicast addresses.
+ * oscP5 website at http://www.sojamo.de/oscP5
+ */
+
+import oscP5.*;
+import netP5.*;
+
+OscP5 oscP5;
+
+void setup() {
+ size(400,400);
+ frameRate(25);
+ /* create a new instance of oscP5 using a multicast socket. */
+ oscP5 = new OscP5(this,"239.0.0.1",7777);
+}
+
+
+void draw() {
+ background(0);
+}
+
+
+void mousePressed() {
+ /* create a new OscMessage with an address pattern, in this case /test. */
+ OscMessage myOscMessage = new OscMessage("/test");
+
+ /* add a value (an integer) to the OscMessage */
+ myOscMessage.add(100);
+
+ /* send the OscMessage to the multicast group.
+ * the multicast group netAddress is the default netAddress, therefore
+ * you dont need to specify a NetAddress to send the osc message.
+ */
+ oscP5.send(myOscMessage);
+}
+
+
+/* incoming osc message are forwarded to the oscEvent method. */
+void oscEvent(OscMessage theOscMessage) {
+ /* print the address pattern and the typetag of the received OscMessage */
+ print("### received an osc message.");
+ print(" addrpattern: "+theOscMessage.addrPattern());
+ println(" typetag: "+theOscMessage.typetag());
+}
Oops, something went wrong.

0 comments on commit 9a56b94

Please sign in to comment.