Permalink
Browse files

Processing example added

  • Loading branch information...
1 parent f697dcf commit 50b03935693484c2adc77134563b1a58c2a53aa6 @ellensundh committed Jun 26, 2012
Showing with 1,175 additions and 0 deletions.
  1. BIN OscProcessingDemo/Helvetica-Bold-18.vlw
  2. +104 −0 OscProcessingDemo/OscDemo.pde
  3. BIN OscProcessingDemo/applet/OscDemo.jar
  4. +113 −0 OscProcessingDemo/applet/OscDemo.java
  5. +85 −0 OscProcessingDemo/applet/OscDemo.pde
  6. BIN OscProcessingDemo/applet/RXTXcomm.jar
  7. BIN OscProcessingDemo/applet/core.jar
  8. +131 −0 OscProcessingDemo/applet/index.html
  9. BIN OscProcessingDemo/applet/loading.gif
  10. BIN OscProcessingDemo/applet/oscP5.jar
  11. BIN OscProcessingDemo/applet/serial.jar
  12. BIN OscProcessingDemo/application.linux32/Helvetica-Bold-18.vlw
  13. +4 −0 OscProcessingDemo/application.linux32/OscDemo
  14. BIN OscProcessingDemo/application.linux32/lib/OscDemo.jar
  15. BIN OscProcessingDemo/application.linux32/lib/RXTXcomm.jar
  16. BIN OscProcessingDemo/application.linux32/lib/core.jar
  17. BIN OscProcessingDemo/application.linux32/lib/oscP5.jar
  18. BIN OscProcessingDemo/application.linux32/lib/serial.jar
  19. BIN OscProcessingDemo/application.linux32/librxtxSerial.so
  20. +104 −0 OscProcessingDemo/application.linux32/source/OscDemo.pde
  21. BIN OscProcessingDemo/application.linux64/Helvetica-Bold-18.vlw
  22. +4 −0 OscProcessingDemo/application.linux64/OscDemo
  23. BIN OscProcessingDemo/application.linux64/lib/OscDemo.jar
  24. BIN OscProcessingDemo/application.linux64/lib/RXTXcomm.jar
  25. BIN OscProcessingDemo/application.linux64/lib/core.jar
  26. BIN OscProcessingDemo/application.linux64/lib/oscP5.jar
  27. BIN OscProcessingDemo/application.linux64/lib/serial.jar
  28. BIN OscProcessingDemo/application.linux64/librxtxSerial.so
  29. +104 −0 OscProcessingDemo/application.linux64/source/OscDemo.pde
  30. BIN OscProcessingDemo/application.macosx/Helvetica-Bold-18.vlw
  31. +75 −0 OscProcessingDemo/application.macosx/OscDemo.app/Contents/Info.plist
  32. BIN OscProcessingDemo/application.macosx/OscDemo.app/Contents/MacOS/JavaApplicationStub
  33. BIN OscProcessingDemo/application.macosx/OscDemo.app/Contents/MacOS/JavaApplicationStub64
  34. +1 −0 OscProcessingDemo/application.macosx/OscDemo.app/Contents/PkgInfo
  35. BIN OscProcessingDemo/application.macosx/OscDemo.app/Contents/Resources/Java/OscDemo.jar
  36. BIN OscProcessingDemo/application.macosx/OscDemo.app/Contents/Resources/Java/RXTXcomm.jar
  37. BIN OscProcessingDemo/application.macosx/OscDemo.app/Contents/Resources/Java/core.jar
  38. BIN OscProcessingDemo/application.macosx/OscDemo.app/Contents/Resources/Java/librxtxSerial.jnilib
  39. BIN OscProcessingDemo/application.macosx/OscDemo.app/Contents/Resources/Java/oscP5.jar
  40. BIN OscProcessingDemo/application.macosx/OscDemo.app/Contents/Resources/Java/serial.jar
  41. BIN OscProcessingDemo/application.macosx/OscDemo.app/Contents/Resources/sketch.icns
  42. +104 −0 OscProcessingDemo/application.macosx/source/OscDemo.pde
  43. BIN OscProcessingDemo/application.windows32/Helvetica-Bold-18.vlw
  44. BIN OscProcessingDemo/application.windows32/OscDemo.exe
  45. BIN OscProcessingDemo/application.windows32/lib/OscDemo.jar
  46. BIN OscProcessingDemo/application.windows32/lib/RXTXcomm.jar
  47. +3 −0 OscProcessingDemo/application.windows32/lib/args.txt
  48. BIN OscProcessingDemo/application.windows32/lib/core.jar
  49. BIN OscProcessingDemo/application.windows32/lib/oscP5.jar
  50. BIN OscProcessingDemo/application.windows32/lib/serial.jar
  51. BIN OscProcessingDemo/application.windows32/rxtxSerial.dll
  52. +132 −0 OscProcessingDemo/application.windows32/source/OscDemo.java
  53. +104 −0 OscProcessingDemo/application.windows32/source/OscDemo.pde
  54. BIN OscProcessingDemo/application.windows64/Helvetica-Bold-18.vlw
  55. BIN OscProcessingDemo/application.windows64/OscDemo.exe
  56. BIN OscProcessingDemo/application.windows64/lib/OscDemo.jar
  57. BIN OscProcessingDemo/application.windows64/lib/RXTXcomm.jar
  58. +3 −0 OscProcessingDemo/application.windows64/lib/args.txt
  59. BIN OscProcessingDemo/application.windows64/lib/core.jar
  60. BIN OscProcessingDemo/application.windows64/lib/oscP5.jar
  61. BIN OscProcessingDemo/application.windows64/lib/serial.jar
  62. BIN OscProcessingDemo/application.windows64/rxtxSerial.dll
  63. +104 −0 OscProcessingDemo/application.windows64/source/OscDemo.pde
Binary file not shown.
@@ -0,0 +1,104 @@
+import oscP5.*;
+import netP5.*;
+import processing.serial.*;
+import java.awt.*;
+
+OscP5 oscP5;
+
+NetAddress myBroadcastLocation;
+
+Panel panel1 = new Panel();
+
+TextField textField = new TextField("/eventtest", 16);
+TextField textField2 = new TextField("3", 16);
+TextField porttf = new TextField("12000", 5);
+float currentValue = 0;
+float counter = 2;
+float toggle = 0;
+
+void setup() {
+ size(400,140);
+ frameRate(25);
+
+ oscP5 = new OscP5(this,12000);
+ myBroadcastLocation = new NetAddress("127.0.0.1",8000);
+
+
+ add(panel1);
+ add(textField);
+ add(textField2);
+
+ panel1.setLayout(new BorderLayout());
+ panel1.setBounds(150,100,50,50);
+
+}
+
+boolean overButton(int x, int y, int width, int height)
+{
+ if (mouseX >= x && mouseX <= x+width &&
+ mouseY >= y && mouseY <= y+height) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+
+void draw() {
+ background(0);
+
+ fill(33, 33,33);
+ rect(140, 40, 115, 35);
+
+ PFont font = loadFont("Helvetica-Bold-18.vlw");
+ textFont(font,18);
+ fill(255, 255,255);
+ text("Send event",150, 50, 200, 70);
+
+ textFont(font,10);
+ fill(255, 255,255);
+ text("Dispatches event to 127.0.0.1 port 8000 Send counter value: " + counter,100, 100, 200, 70);
+ sendCounter();
+}
+
+
+void mousePressed() {
+ if( overButton(140, 40, 115, 35)) {
+ sendEvent(textField.getText(),textField2.getText());
+ }
+}
+
+void sendEvent(String eventName, String eventData) {
+ OscMessage myOscMessage = new OscMessage("/eventTest");
+ myOscMessage.add(eventData);
+ oscP5.send(myOscMessage, myBroadcastLocation);
+}
+
+void sendCounter() {
+ OscMessage myOscMessage = new OscMessage("/counterTest");
+
+ if(counter == 50) {
+ toggle = 1;
+ } else if(counter == 2) {
+ toggle = 0;
+ }
+
+ if(toggle == 0) {
+ counter++;
+ } else if(toggle == 1) {
+ counter--;
+ }
+ println(counter);
+ myOscMessage.add(counter);
+ oscP5.send(myOscMessage, myBroadcastLocation);
+}
+
+
+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();
+}
+
+
Binary file not shown.
@@ -0,0 +1,113 @@
+import processing.core.*;
+import processing.xml.*;
+
+import oscP5.*;
+import netP5.*;
+import processing.serial.*;
+import java.awt.*;
+
+import java.applet.*;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.event.MouseEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.FocusEvent;
+import java.awt.Image;
+import java.io.*;
+import java.net.*;
+import java.text.*;
+import java.util.*;
+import java.util.zip.*;
+import java.util.regex.*;
+
+public class OscDemo extends PApplet {
+
+
+
+
+
+
+OscP5 oscP5;
+
+NetAddress myBroadcastLocation;
+
+Panel panel1 = new Panel();
+
+TextField textField = new TextField("eventname", 16);
+TextField textField2 = new TextField("eventdata", 16);
+TextField porttf = new TextField("12000", 5);
+
+
+
+
+
+public void setup() {
+ size(400,140);
+ frameRate(25);
+
+ oscP5 = new OscP5(this,12000);
+ myBroadcastLocation = new NetAddress("127.0.0.1",8000);
+
+
+ add(panel1);
+ add(textField);
+ add(textField2);
+
+ panel1.setLayout(new BorderLayout());
+ panel1.setBounds(150,100,50,50);
+
+}
+
+public boolean overButton(int x, int y, int width, int height)
+{
+ if (mouseX >= x && mouseX <= x+width &&
+ mouseY >= y && mouseY <= y+height) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+
+public void draw() {
+ background(0);
+
+ fill(33, 33,33);
+ rect(140, 40, 115, 35);
+
+ PFont font = loadFont("Helvetica-Bold-18.vlw");
+ textFont(font,18);
+ fill(255, 255,255);
+ text("Send event",150, 50, 200, 70);
+
+ textFont(font,10);
+ fill(255, 255,255);
+ text("Dispatces event to 127.0.0.1 port 8000",100, 100, 200, 70);
+}
+
+
+public void mousePressed() {
+ if( overButton(140, 40, 115, 35)) {
+ sendEvent(textField.getText(),textField2.getText());
+ }
+}
+
+public void sendEvent(String eventName, String eventData) {
+
+
+ OscMessage myOscMessage = new OscMessage(eventName + "/" + eventData);
+ oscP5.send(myOscMessage, myBroadcastLocation);
+}
+
+public 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();
+}
+
+
+ static public void main(String args[]) {
+ PApplet.main(new String[] { "--bgcolor=#FFFFFF", "OscDemo" });
+ }
+}
@@ -0,0 +1,85 @@
+import oscP5.*;
+import netP5.*;
+import processing.serial.*;
+import java.awt.*;
+
+OscP5 oscP5;
+
+NetAddress myBroadcastLocation;
+
+Panel panel1 = new Panel();
+
+TextField textField = new TextField("eventname", 16);
+TextField textField2 = new TextField("eventdata", 16);
+TextField porttf = new TextField("12000", 5);
+
+
+
+
+
+void setup() {
+ size(400,140);
+ frameRate(25);
+
+ oscP5 = new OscP5(this,12000);
+ myBroadcastLocation = new NetAddress("127.0.0.1",8000);
+
+
+ add(panel1);
+ add(textField);
+ add(textField2);
+
+ panel1.setLayout(new BorderLayout());
+ panel1.setBounds(150,100,50,50);
+
+}
+
+boolean overButton(int x, int y, int width, int height)
+{
+ if (mouseX >= x && mouseX <= x+width &&
+ mouseY >= y && mouseY <= y+height) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+
+void draw() {
+ background(0);
+
+ fill(33, 33,33);
+ rect(140, 40, 115, 35);
+
+ PFont font = loadFont("Helvetica-Bold-18.vlw");
+ textFont(font,18);
+ fill(255, 255,255);
+ text("Send event",150, 50, 200, 70);
+
+ textFont(font,10);
+ fill(255, 255,255);
+ text("Dispatces event to 127.0.0.1 port 8000",100, 100, 200, 70);
+}
+
+
+void mousePressed() {
+ if( overButton(140, 40, 115, 35)) {
+ sendEvent(textField.getText(),textField2.getText());
+ }
+}
+
+void sendEvent(String eventName, String eventData) {
+
+
+ OscMessage myOscMessage = new OscMessage(eventName + "/" + eventData);
+ oscP5.send(myOscMessage, myBroadcastLocation);
+}
+
+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();
+}
+
+
Binary file not shown.
Binary file not shown.
Oops, something went wrong.

0 comments on commit 50b0393

Please sign in to comment.