Skip to content
Permalink
Browse files

updated osc format

  • Loading branch information...
n1ckfg committed Oct 31, 2013
1 parent fa6ca8a commit 235b7baaca2fdf68b4117126f0673c53bdcb272b
@@ -3,6 +3,7 @@ class HandPoint {
int numFingers = 5;
int numOrigins = numFingers;
int numTools = numFingers;
int idActive = 0;
int idHand = 0;
color fgColor = color(0, 0, 255);
String pointType = "hand";
@@ -84,7 +85,7 @@ class HandPoint {
myMessage.add(p.y/sH);
myMessage.add(p.z/sD);
oscP5.send(myMessage, myRemoteLocation);
}else{
}else if(oscFormat.equals("OldManos")){
myMessage = new OscMessage("/" + "hand" + idHand);
myMessage.add(pointType);
myMessage.add(idHand);
@@ -98,6 +99,21 @@ class HandPoint {
myMessage.add(p.z/sD);
}
oscP5.send(myMessage, myRemoteLocation);
}else{ //default
myMessage = new OscMessage("/" + "hand" + idHand);
myMessage.add(pointType);
myMessage.add(idHand);
myMessage.add(idActive);
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);
}
}catch(Exception e){ }
}
@@ -153,6 +153,7 @@ void draw() {
catch(Exception e) {
}
}
handPoints[handCounter].idActive = originCounter; //this updates hand's internal count of active pointables

//fingers on a hand
for (Finger finger : leap.getFingerList(hand)) {
@@ -243,7 +244,7 @@ void draw() {
sayText[16] = "osc channel /joint [ (s) finger1-4, (i) " + handPoints[1].idHand + convertVals(handPoints[1].fingerPoints[4].p, "finger");
sayText[17] = "";
sayText[18] = "osc channel /active [ (i) " + activeHands+ ", (i) " + activeFingers + ", (i) " + activeTools + ", (i) " + activeOrigins + " ]";
}else{ //default
}else if(oscFormat.equals("OldManos")){
sayText[4] = "osc channel /hand0 [ (s) " + handPoints[0].pointType + ", (i) " + handPoints[0].idHand + convertVals(handPoints[0].p, "hand");
sayText[5] = "osc channel /finger0-0 [ (s) " + handPoints[0].fingerPoints[0].pointType + ", (i) " + handPoints[0].idHand + ", (i) " + handPoints[0].fingerPoints[0].idPointable + convertVals(handPoints[0].fingerPoints[0].p, "finger");
sayText[6] = "osc channel /finger0-1 [ (s) " + handPoints[0].fingerPoints[1].pointType + ", (i) " + handPoints[0].idHand + ", (i) " + handPoints[0].fingerPoints[1].idPointable + convertVals(handPoints[0].fingerPoints[1].p, "finger");
@@ -259,6 +260,22 @@ void draw() {
sayText[16] = "osc channel /finger1-4 [ (s) " + handPoints[1].fingerPoints[4].pointType + ", (i) " + handPoints[1].idHand + ", (i) " + handPoints[1].fingerPoints[4].idPointable + convertVals(handPoints[1].fingerPoints[4].p, "finger");
sayText[17] = "";
sayText[18] = "osc channel /active [ (i) " + activeHands+ ", (i) " + activeFingers + ", (i) " + activeTools + ", (i) " + activeOrigins + " ]";
}else{ //default
sayText[4] = "osc channel /hand0 [ (s) " + handPoints[0].pointType + ", (i) " + handPoints[0].idHand + ", (i) " + handPoints[0].idActive + convertVals(handPoints[0].p, "hand");
sayText[5] = "osc channel /finger0-0 [ (s) " + handPoints[0].fingerPoints[0].pointType + ", (i) " + handPoints[0].idHand + ", (i) " + handPoints[0].fingerPoints[0].idPointable + convertVals(handPoints[0].fingerPoints[0].p, "finger");
sayText[6] = "osc channel /finger0-1 [ (s) " + handPoints[0].fingerPoints[1].pointType + ", (i) " + handPoints[0].idHand + ", (i) " + handPoints[0].fingerPoints[1].idPointable + convertVals(handPoints[0].fingerPoints[1].p, "finger");
sayText[7] = "osc channel /finger0-2 [ (s) " + handPoints[0].fingerPoints[2].pointType + ", (i) " + handPoints[0].idHand + ", (i) " + handPoints[0].fingerPoints[2].idPointable + convertVals(handPoints[0].fingerPoints[2].p, "finger");
sayText[8] = "osc channel /finger0-3 [ (s) " + handPoints[0].fingerPoints[3].pointType + ", (i) " + handPoints[0].idHand + ", (i) " + handPoints[0].fingerPoints[3].idPointable + convertVals(handPoints[0].fingerPoints[3].p, "finger");
sayText[9] = "osc channel /finger0-4 [ (s) " + handPoints[0].fingerPoints[4].pointType + ", (i) " + handPoints[0].idHand + ", (i) " + handPoints[0].fingerPoints[4].idPointable + convertVals(handPoints[0].fingerPoints[4].p, "finger");
sayText[10]="";
sayText[11] = "osc channel /hand1 [ (s) " + handPoints[1].pointType + ", (i) " + handPoints[1].idHand + ", (i) " + handPoints[1].idActive + convertVals(handPoints[1].p, "hand");
sayText[12] = "osc channel /finger1-0 [ (s) " + handPoints[1].fingerPoints[0].pointType + ", (i) " + handPoints[1].idHand + ", (i) " + handPoints[1].fingerPoints[0].idPointable + convertVals(handPoints[1].fingerPoints[0].p, "finger");
sayText[13] = "osc channel /finger1-1 [ (s) " + handPoints[1].fingerPoints[1].pointType + ", (i) " + handPoints[1].idHand + ", (i) " + handPoints[1].fingerPoints[1].idPointable + convertVals(handPoints[1].fingerPoints[1].p, "finger");
sayText[14] = "osc channel /finger1-2 [ (s) " + handPoints[1].fingerPoints[2].pointType + ", (i) " + handPoints[1].idHand + ", (i) " + handPoints[1].fingerPoints[2].idPointable + convertVals(handPoints[1].fingerPoints[2].p, "finger");
sayText[15] = "osc channel /finger1-3 [ (s) " + handPoints[1].fingerPoints[3].pointType + ", (i) " + handPoints[1].idHand + ", (i) " + handPoints[1].fingerPoints[3].idPointable + convertVals(handPoints[1].fingerPoints[3].p, "finger");
sayText[16] = "osc channel /finger1-4 [ (s) " + handPoints[1].fingerPoints[4].pointType + ", (i) " + handPoints[1].idHand + ", (i) " + handPoints[1].fingerPoints[4].idPointable + convertVals(handPoints[1].fingerPoints[4].p, "finger");
sayText[17] = "";
sayText[18] = "osc channel /active [ (i) " + activeHands+ ", (i) " + activeFingers + ", (i) " + activeTools + ", (i) " + activeOrigins + " ]";
}
}else{
sayText[4] = "midi ctl for hand0 [ (" + handPoints[0].getMidiId(1) + ") " + handPoints[0].getMidiVal(handPoints[0].p.x,sW) + ", (" + handPoints[0].getMidiId(2) + ") " + handPoints[0].getMidiVal(handPoints[0].p.y,sH) + ", (" + handPoints[0].getMidiId(3) + ") " + handPoints[0].getMidiVal(handPoints[0].p.z,sD) + " ]";
@@ -437,7 +454,7 @@ String convertVals(PVector p, String t) {
if(oscFormat.equals("Animata")){
s = ", (f) " + rounder(640 * (p.x/sW), 3) + ", (f) " + rounder(480 * (p.y/sH), 3) + " ]";
}else{
if (t=="hand") {
if (t=="hand") { //doesn't appear to do anything; was I planning to have something different for hands?
if (centerMode) {
s = ", (f) " + rounder((2.0*(p.x/sW))-1.0, 3) + ", (f) " + rounder((2.0*(p.y/sH))-1.0, 3) + ", (f) " + rounder((2.0*(p.z/sD))-1.0, 3) + " ]";
}
@@ -93,7 +93,23 @@ class PointablePoint{
myMessage.add(p.y/sH);
myMessage.add(p.z/sD);
oscP5.send(myMessage, myRemoteLocation);
}else{
}else if(oscFormat.equals("OldManos")){
//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);
}else{ //default
//myMessage = new OscMessage("/" + "finger" + idHand + "-" + idPointable);
myMessage = new OscMessage("/" + pointType + idHand + "-" + idPointable);
myMessage.add(pointType);
@@ -27,7 +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("OSC Channel Format (Manos, OldManos, 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.4
ManosOsc 1.1.5
by Nick Fox-Gieg | fox-gieg.com

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
@@ -42,7 +42,7 @@ Processing: http://processing.org/

* Hand channels:
contents:
string (name), int (hand id), float (x), float (y), float (z)
string (name), int (hand id), int (active origins), float (x), float (y), float (z)

names:
/hand0
@@ -73,7 +73,8 @@ int (active hands), int (active fingers), int (active tools), int (active origin
name:
/active

* If you'd like to send different channel message formats, change the "OSC Channel Format" setting.
* If you'd like to send different channel message formats, change the "OSC Channel Format" setting. Supported apps include Isadora, OSCeleton, and Animata. To preserve compatibility with old projects, you can also choose the "OldManos" format setting, which had a different message format for hands:
string (name), int (hand id), float (x), float (y), float (z)

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

@@ -8,7 +8,7 @@
"architecture" : "x86"
}
,
"rect" : [ 797.0, 47.0, 629.0, 509.0 ],
"rect" : [ 623.0, 159.0, 629.0, 509.0 ],
"bglocked" : 0,
"openinpresentation" : 0,
"default_fontsize" : 12.0,
@@ -324,10 +324,10 @@
"id" : "obj-8",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 5,
"outlettype" : [ "float", "float", "float", "float", "float" ],
"patching_rect" : [ 126.0, 180.0, 83.0, 20.0 ],
"text" : "unpack f f f f f"
"numoutlets" : 6,
"outlettype" : [ "", "int", "int", "float", "float", "float" ],
"patching_rect" : [ 126.0, 180.0, 91.0, 20.0 ],
"text" : "unpack s i i f f f"
}

}
@@ -567,7 +567,7 @@
"destination" : [ "obj-14", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-8", 2 ]
"source" : [ "obj-8", 3 ]
}

}
@@ -576,7 +576,7 @@
"destination" : [ "obj-16", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-8", 3 ]
"source" : [ "obj-8", 4 ]
}

}
@@ -585,7 +585,7 @@
"destination" : [ "obj-17", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-8", 4 ]
"source" : [ "obj-8", 5 ]
}

}

This file was deleted.

Binary file not shown.
@@ -8,7 +8,7 @@
"architecture" : "x86"
}
,
"rect" : [ 797.0, 47.0, 629.0, 509.0 ],
"rect" : [ 623.0, 159.0, 629.0, 509.0 ],
"bglocked" : 0,
"openinpresentation" : 0,
"default_fontsize" : 12.0,
@@ -324,10 +324,10 @@
"id" : "obj-8",
"maxclass" : "newobj",
"numinlets" : 1,
"numoutlets" : 5,
"outlettype" : [ "float", "float", "float", "float", "float" ],
"patching_rect" : [ 126.0, 180.0, 83.0, 20.0 ],
"text" : "unpack f f f f f"
"numoutlets" : 6,
"outlettype" : [ "", "int", "int", "float", "float", "float" ],
"patching_rect" : [ 126.0, 180.0, 91.0, 20.0 ],
"text" : "unpack s i i f f f"
}

}
@@ -567,7 +567,7 @@
"destination" : [ "obj-14", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-8", 2 ]
"source" : [ "obj-8", 3 ]
}

}
@@ -576,7 +576,7 @@
"destination" : [ "obj-16", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-8", 3 ]
"source" : [ "obj-8", 4 ]
}

}
@@ -585,7 +585,7 @@
"destination" : [ "obj-17", 0 ],
"disabled" : 0,
"hidden" : 0,
"source" : [ "obj-8", 4 ]
"source" : [ "obj-8", 5 ]
}

}

This file was deleted.

Binary file not shown.
@@ -7,7 +7,7 @@ OSC Send Port
Send OSC Active
true

OSC Channel Format (Manos, OSCeleton, Animata, Isadora)
OSC Channel Format (Manos, OldManos, OSCeleton, Animata, Isadora)
Manos

MIDI Send Channel

0 comments on commit 235b7ba

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