You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.6 KiB

int OSCleftButton = 0;
int OSCrightButton = 0;
int tmpButton = 0;
float OSCleftX = 0;
float OSCleftY = 0;
float OSCrightX = 0;
float OSCrightY = 0;
float OSCvalue = 0;
void oscEvent(OscMessage theOscMessage) {
if(theOscMessage.checkTypetag("s")){
OSCvalue = parseFloat(theOscMessage.get(0).toString().replaceAll(",","."));
}
switch(theOscMessage.addrPattern()) {
case "lb":
tmpButton = theOscMessage.get(0).intValue();
if(OSCleftButton != tmpButton) {
OSCleftButton = tmpButton;
}
break;
case "/lx":
OSCleftX = OSCvalue;
freqs[OSCleftButton-1] = OSCvalue;
break;
case "/ly":
OSCleftY = OSCvalue;
instruments[OSCleftButton-1] = parseInt(OSCleftX)/2;
break;
case "rb":
OSCrightButton = theOscMessage.get(0).intValue();
break;
case "/rx":
OSCrightX = OSCvalue;
break;
case "/ry":
OSCrightY = OSCvalue;
break;
}
printOSC(false, theOscMessage);
}
void printOSC(boolean show, OscMessage theOscMessage) {
if(show) {
print("### Pattern: "+theOscMessage.addrPattern());
print(" TypeTag:"+theOscMessage.typetag());
if(theOscMessage.checkTypetag("i")){
print(" Value: "+theOscMessage.get(0).intValue());
}
if(theOscMessage.checkTypetag("s")){
OSCvalue = parseFloat(theOscMessage.get(0).toString().replaceAll(",","."));
print(" Value: "+OSCvalue);
}
println();
}
print(OSCleftButton+"\t");
print(OSCrightButton+"\t");
print(OSCleftX+"\t");
print(OSCleftY+"\t");
print(OSCrightX+"\t");
println(OSCrightY+"\t");
}