Well i couldn't get that to work properly! The problem i'm having is getting the clip / layer values match the array.
At the moment i'm using the following which works, but i'm not sure i like having to do the string processing like this, seems like it is inefficient?
Code: Select all
void oscEvent(OscMessage theOscMessage) {
String resAddr = theOscMessage.addrPattern();
boolean hasConnect = resAddr.contains("connect");
boolean hasActive = resAddr.contains("active"); // so we can ignore active clip connect msg
boolean hasBug = resAddr.contains("connectclip"); // sometimes resolume sends an ocs message with this, its a bug afaik.
int x = 1,y = 1;
if (hasConnect ==true && hasActive == false && hasBug == false) {
if (resAddr.contains("layer1") == true){y = 3;}
if (resAddr.contains("layer2") == true){y = 2;}
if (resAddr.contains("layer3") == true){y = 1;}
if (resAddr.contains("layer4") == true){y = 0;}
if (resAddr.contains("clip1") == true){x = 0;}
if (resAddr.contains("clip2") == true){x = 1;}
if (resAddr.contains("clip3") == true){x = 2;}
if (resAddr.contains("clip4") == true){x = 3;}
if (resAddr.contains("clip5") == true){x = 4;}
if (resAddr.contains("clip6") == true){x = 5;}
if (resAddr.contains("clip7") == true){x = 6;}
if (resAddr.contains("clip8") == true){x = 7;}
/* check if the typetag is the right one. */
if (theOscMessage.checkTypetag("i")) {
/* parse theOscMessage and extract the values from the osc message arguments. */
int firstValue = theOscMessage.get(0).intValue();
println(resAddr+" OSC Connect msg "+firstValue);
connectGrid[x][y]=firstValue;
return;
}
}
}
I apologise if these questions are stupid, I'm really not a programer at all! (i should probably go and read some books or something first)