Skip to content
Permalink
Browse files

examples, new OSC formats

  • Loading branch information...
n1ckfg committed Oct 28, 2013
1 parent 4053e24 commit 3bd6050a1de42082260584dd3873524b74cdc134
Showing with 2,635 additions and 54 deletions.
  1. +6 −3 Controls.pde
  2. +45 −12 HandPoint.pde
  3. +56 −24 ManosOsc.pde
  4. +14 −0 Osc.pde
  5. +70 −12 PointablePoint.pde
  6. +1 −0 Settings.pde
  7. +12 −1 data/README.txt
  8. +127 −0 data/examples-osx/Processing example/source/ReceiveExample/Button.pde
  9. +123 −0 data/examples-osx/Processing example/source/ReceiveExample/Data.pde
  10. +183 −0 data/examples-osx/Processing example/source/ReceiveExample/OpenGL.pde
  11. +58 −0 data/examples-osx/Processing example/source/ReceiveExample/Osc.pde
  12. +93 −0 data/examples-osx/Processing example/source/ReceiveExample/OscFinger.pde
  13. +88 −0 data/examples-osx/Processing example/source/ReceiveExample/OscHand.pde
  14. +82 −0 data/examples-osx/Processing example/source/ReceiveExample/OscTool.pde
  15. +54 −0 data/examples-osx/Processing example/source/ReceiveExample/Particle.pde
  16. +79 −0 data/examples-osx/Processing example/source/ReceiveExample/ReceiveExample.pde
  17. +115 −0 data/examples-osx/Processing example/source/ReceiveExample/Settings.pde
  18. BIN data/examples-osx/Processing example/source/ReceiveExample/code/oscP5.jar
  19. +15 −0 data/examples-osx/Processing example/source/ReceiveExample/data/Blend4.glsl
  20. +11 −0 data/examples-osx/Processing example/source/ReceiveExample/data/Blend4.xml
  21. +22 −0 data/examples-osx/Processing example/source/ReceiveExample/data/Blur.glsl
  22. +8 −0 data/examples-osx/Processing example/source/ReceiveExample/data/Blur.xml
  23. +49 −0 data/examples-osx/Processing example/source/ReceiveExample/data/Blur1D.glsl
  24. +11 −0 data/examples-osx/Processing example/source/ReceiveExample/data/Blur1D.xml
  25. +6 −0 data/examples-osx/Processing example/source/ReceiveExample/data/Copy.glsl
  26. +6 −0 data/examples-osx/Processing example/source/ReceiveExample/data/Copy.xml
  27. BIN data/examples-osx/Processing example/source/ReceiveExample/data/EstrangeloEdessa-24.vlw
  28. +19 −0 data/examples-osx/Processing example/source/ReceiveExample/data/ExtractBloom.glsl
  29. +11 −0 data/examples-osx/Processing example/source/ReceiveExample/data/ExtractBloom.xml
  30. +5 −0 data/examples-osx/Processing example/source/ReceiveExample/data/SimpleVS.glsl
  31. +26 −0 data/examples-osx/Processing example/source/ReceiveExample/data/ToneMap.glsl
  32. +14 −0 data/examples-osx/Processing example/source/ReceiveExample/data/ToneMap.xml
  33. +8 −0 data/examples-osx/Processing example/source/ReceiveExample/settings.txt
  34. +127 −0 data/examples-win/Processing example/source/ReceiveExample/Button.pde
  35. +123 −0 data/examples-win/Processing example/source/ReceiveExample/Data.pde
  36. +183 −0 data/examples-win/Processing example/source/ReceiveExample/OpenGL.pde
  37. +58 −0 data/examples-win/Processing example/source/ReceiveExample/Osc.pde
  38. +93 −0 data/examples-win/Processing example/source/ReceiveExample/OscFinger.pde
  39. +88 −0 data/examples-win/Processing example/source/ReceiveExample/OscHand.pde
  40. +82 −0 data/examples-win/Processing example/source/ReceiveExample/OscTool.pde
  41. +54 −0 data/examples-win/Processing example/source/ReceiveExample/Particle.pde
  42. +79 −0 data/examples-win/Processing example/source/ReceiveExample/ReceiveExample.pde
  43. +115 −0 data/examples-win/Processing example/source/ReceiveExample/Settings.pde
  44. BIN data/examples-win/Processing example/source/ReceiveExample/code/oscP5.jar
  45. +15 −0 data/examples-win/Processing example/source/ReceiveExample/data/Blend4.glsl
  46. +11 −0 data/examples-win/Processing example/source/ReceiveExample/data/Blend4.xml
  47. +22 −0 data/examples-win/Processing example/source/ReceiveExample/data/Blur.glsl
  48. +8 −0 data/examples-win/Processing example/source/ReceiveExample/data/Blur.xml
  49. +49 −0 data/examples-win/Processing example/source/ReceiveExample/data/Blur1D.glsl
  50. +11 −0 data/examples-win/Processing example/source/ReceiveExample/data/Blur1D.xml
  51. +6 −0 data/examples-win/Processing example/source/ReceiveExample/data/Copy.glsl
  52. +6 −0 data/examples-win/Processing example/source/ReceiveExample/data/Copy.xml
  53. BIN data/examples-win/Processing example/source/ReceiveExample/data/EstrangeloEdessa-24.vlw
  54. +19 −0 data/examples-win/Processing example/source/ReceiveExample/data/ExtractBloom.glsl
  55. +11 −0 data/examples-win/Processing example/source/ReceiveExample/data/ExtractBloom.xml
  56. +5 −0 data/examples-win/Processing example/source/ReceiveExample/data/SimpleVS.glsl
  57. +26 −0 data/examples-win/Processing example/source/ReceiveExample/data/ToneMap.glsl
  58. +14 −0 data/examples-win/Processing example/source/ReceiveExample/data/ToneMap.xml
  59. +8 −0 data/examples-win/Processing example/source/ReceiveExample/settings.txt
  60. +5 −2 data/settings.txt
@@ -1,7 +1,10 @@
void keyPressed() {
if (key=='z' || key=='Z') reverseZ = !reverseZ;
if (key=='d' || key=='D'){
if(debug && !debugDisplayMidi){
if(!debug && debugDisplayMidi){ //if debug was turned off, show OSC screen first
debug = true;
debugDisplayMidi = false;
}else if(debug && !debugDisplayMidi){ //if already showing the OSC screen, switch to MIDI screen
debugDisplayMidi = true;
}else{
debugDisplayMidi = false;
@@ -11,11 +14,11 @@ void keyPressed() {
if (key=='t' || key=='T') showTraces = !showTraces;
if (key=='m' || key=='M'){
sendMidi = !sendMidi;
//if(sendMidi) debugDisplayMidi = true;
if(sendMidi) debugDisplayMidi = true;
}
if (key=='o' || key=='O'){
sendOsc = !sendOsc;
//if(sendOsc) debugDisplayMidi = false;
if(sendOsc) debugDisplayMidi = false;
}
if (key=='f' || key=='F') openAppFolderHandler();
/*
@@ -6,14 +6,16 @@ class HandPoint {
int idHand = 0;
color fgColor = color(0, 0, 255);
String pointType = "hand";
//boolean active = false;

boolean active = false;
boolean clicked = false;

PointablePoint[] fingerPoints = new PointablePoint[numFingers];
PointablePoint[] toolPoints = new PointablePoint[numTools];
PointablePoint[] originPoints = new PointablePoint[numOrigins];
ArrayList handPath;
PVector pStart = new PVector(0,0,0);
PVector p = new PVector(0,0,0);
PVector pp = new PVector(0,0,0); //previous position

HandPoint(int _ih, PVector _p) {
idHand = _ih;
@@ -36,6 +38,11 @@ class HandPoint {
if(record||showTraces) handPath.add(p);
if(sendOsc) sendHandOsc();
if(sendMidi) sendHandMidi();
if(pp == p){
active = false;
}else{
active = true;
}
}

void draw() {
@@ -53,19 +60,45 @@ class HandPoint {
void sendHandOsc() {
OscMessage myMessage;
try{
myMessage = new OscMessage("/" + "hand" + idHand);
myMessage.add(pointType);
myMessage.add(idHand);
if(centerMode){
myMessage.add((2.0*(p.x/sW))-1.0);
myMessage.add((2.0*(p.y/sH))-1.0);
myMessage.add((2.0*(p.z/sD))-1.0);
}else{
if(oscFormat.equals("Animata")){
myMessage = new OscMessage("/joint");
myMessage.add("hand" + idHand);
myMessage.add(((p.x/sW)*640)+0);
myMessage.add(((p.y/sH)*480)+0);
oscP5.send(myMessage, myRemoteLocation);
}else if(oscFormat.equals("Isadora")){
myMessage = new OscMessage("/isadora/"+getMidiId(1));
myMessage.add(p.x/sW);
oscP5.send(myMessage, myRemoteLocation);
myMessage = new OscMessage("/isadora/"+getMidiId(2));
myMessage.add(p.y/sH);
myMessage.add(p.z/sD);
oscP5.send(myMessage, myRemoteLocation);
myMessage = new OscMessage("/isadora/"+getMidiId(3));
myMessage.add(p.z/sD);
oscP5.send(myMessage, myRemoteLocation);
}else if(oscFormat.equals("OSCeleton")){
myMessage = new OscMessage("/joint");
myMessage.add("hand" + idHand);
myMessage.add(idHand);
myMessage.add(p.x/sW);
myMessage.add(p.y/sH);
myMessage.add(p.z/sD);
oscP5.send(myMessage, myRemoteLocation);
}else{
myMessage = new OscMessage("/" + "hand" + idHand);
myMessage.add(pointType);
myMessage.add(idHand);
if(centerMode){
myMessage.add((2.0*(p.x/sW))-1.0);
myMessage.add((2.0*(p.y/sH))-1.0);
myMessage.add((2.0*(p.z/sD))-1.0);
}else{
myMessage.add(p.x/sW);
myMessage.add(p.y/sH);
myMessage.add(p.z/sD);
}
oscP5.send(myMessage, myRemoteLocation);
}
oscP5.send(myMessage, myRemoteLocation);
}catch(Exception e){ }
}

Large diffs are not rendered by default.

14 Osc.pde
@@ -19,3 +19,17 @@ void oscTester(){
myMessage.add(testData);
oscP5.send(myMessage, myRemoteLocation);
}

void sendActiveOsc() {
OscMessage myMessage;
try{
//myMessage = new OscMessage("/" + "finger" + idHand + "-" + idPointable);
myMessage = new OscMessage("/active");
myMessage.add(activeHands);
myMessage.add(activeFingers);
myMessage.add(activeTools);
myMessage.add(activeOrigins);
oscP5.send(myMessage, myRemoteLocation);
}catch(Exception e){ }
//println("Active hands: " + activeHands + " fingers: " + activeFingers + " tools: " + activeTools + " origins: " + activeOrigins);
}
@@ -1,11 +1,13 @@
class PointablePoint{
ArrayList pointablePath;
PVector p = new PVector(0,0,0);
PVector pp = new PVector(0,0,0); //previous position
int idPointable = 0;
int idHand = 0;
color fgColor = color(255);
String pointType = "pointable";
//boolean active = false;
boolean active = false;
boolean clicked = false;

PointablePoint(int _ip, int _ih, PVector _p, color _c, String _s){
idPointable = _ip;
@@ -21,6 +23,11 @@ class PointablePoint{
if(record||showTraces) pointablePath.add(p);
if(sendOsc) sendPointableOsc();
if(sendMidi) sendPointableMidi();
if(pp == p){
active = false;
}else{
active = true;
}
}

void draw(){
@@ -38,20 +45,71 @@ class PointablePoint{
void sendPointableOsc() {
OscMessage myMessage;
try{
myMessage = new OscMessage("/" + "finger" + idHand + "-" + idPointable);
myMessage.add(pointType);
myMessage.add(idHand);
myMessage.add(idPointable);
if(centerMode){
myMessage.add((2.0*(p.x/sW))-1.0);
myMessage.add((2.0*(p.y/sH))-1.0);
myMessage.add((2.0*(p.z/sD))-1.0);
}else{
if(oscFormat.equals("Animata")){
myMessage = new OscMessage("/joint");
myMessage.add(pointType + idHand + "-" + idPointable);
myMessage.add(((p.x/sW)*640)+0);
myMessage.add(((p.y/sH)*480)+0);
oscP5.send(myMessage, myRemoteLocation);
}else if(oscFormat.equals("Isadora")){
int a=0;
int b=0;
int c=0;
if(idPointable==0){
a = 4;
b = 5;
c = 6;
}else if(idPointable==1){
a = 7;
b = 8;
c = 9;
}else if(idPointable==2){
a = 10;
b = 11;
c = 12;
}else if(idPointable==3){
a = 13;
b = 14;
c = 15;
}else if(idPointable==4){
a = 16;
b = 17;
c = 18;
}
myMessage = new OscMessage("/isadora/"+getMidiId(a));
myMessage.add(p.x/sW);
oscP5.send(myMessage, myRemoteLocation);
myMessage = new OscMessage("/isadora/"+getMidiId(b));
myMessage.add(p.y/sH);
oscP5.send(myMessage, myRemoteLocation);
myMessage = new OscMessage("/isadora/"+getMidiId(c));
myMessage.add(p.z/sD);
oscP5.send(myMessage, myRemoteLocation);
}else if(oscFormat.equals("OSCeleton")){
myMessage = new OscMessage("/joint");
myMessage.add(pointType + idHand + "-" + idPointable);
myMessage.add(idHand);
myMessage.add(p.x/sW);
myMessage.add(p.y/sH);
myMessage.add(p.z/sD);
myMessage.add(p.z/sD);
oscP5.send(myMessage, myRemoteLocation);
}else{
//myMessage = new OscMessage("/" + "finger" + idHand + "-" + idPointable);
myMessage = new OscMessage("/" + pointType + idHand + "-" + idPointable);
myMessage.add(pointType);
myMessage.add(idHand);
myMessage.add(idPointable);
if(centerMode){
myMessage.add((2.0*(p.x/sW))-1.0);
myMessage.add((2.0*(p.y/sH))-1.0);
myMessage.add((2.0*(p.z/sD))-1.0);
}else{
myMessage.add(p.x/sW);
myMessage.add(p.y/sH);
myMessage.add(p.z/sD);
}
oscP5.send(myMessage, myRemoteLocation);
}
oscP5.send(myMessage, myRemoteLocation);
}catch(Exception e){ }
}

@@ -27,6 +27,7 @@ class Settings {
if (settings.data[i].equals("Send OSC Active")) sendOsc = setBoolean(settings.data[i+1]);
if (settings.data[i].equals("OSC Send IP Number")) ipNumber = setString(settings.data[i+1]);
if (settings.data[i].equals("OSC Send Port")) sendPort = setInt(settings.data[i+1]);
if (settings.data[i].equals("OSC Channel Format (Manos, OSCeleton, Animata, Isadora)")) oscFormat = setString(settings.data[i+1]);
if (settings.data[i].equals("Save Maya Python")) writeMaya = setBoolean(settings.data[i+1]);
if (settings.data[i].equals("Maya Offset Translate")) mayaOffsetTranslate = setPVector(settings.data[i+1]);
if (settings.data[i].equals("Maya Offset Scale")) mayaOffsetScale = setPVector(settings.data[i+1]);
@@ -1,4 +1,4 @@
ManosOsc 1.1.0
ManosOsc 1.1.4
by Nick Fox-Gieg | fox-gieg.com

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
@@ -64,6 +64,17 @@ names:
/finger1-3
/finger1-4

* The same naming convention is used for tool and origin (first knuckle) channels.

* Active channel:
contents:
int (active hands), int (active fingers), int (active tools), int (active origins)

name:
/active

* If you'd like to send different channel message formats, change the "OSC Channel Format" setting.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

IV. MIDI (Musical Instrument Digital Interface)

0 comments on commit 3bd6050

Please sign in to comment.
You can’t perform that action at this time.