Help pleeesz
in
Contributed Library Questions
•
2 years ago
Hi folks
a complete newbie and in dire need of your help
i am trying to get this sketch working and getting stone walled
trying to resolve the value from osc ( /2/spdob) a fader in touch osc
import oscP5.*;
import netP5.*;
OscP5 oscP5;
float [] fader = new float [3];
String str = "a";
int num=0;
int z;
void setup() {
size(400,400);
frameRate(25);
/* start oscP5, listening for incoming messages at port 8000 */
oscP5 = new OscP5(this,8000);
}
void draw() {
background(0);
}
void oscEvent(OscMessage theOscMessage) {
str = theOscMessage.addrPattern();
if(str.equals("/2/spdob") == true) {
println("forward"); //
} else {
println("static");
}
String addr = theOscMessage.typetag();
if(addr.indexOf(str) !=-1){
String list[] = split(addr,'/');
int xfader = int(list[2].charAt(5) - 0x30);
if(theOscMessage.get(0).floatValue() !=0){
fader[xfader] = theOscMessage.get(0).floatValue();
}
}
z = (round(fader[2]));
println(z);
//println(fader[1]));
//println(" typetag: "+theOscMessage.typetag());
}
import netP5.*;
OscP5 oscP5;
float [] fader = new float [3];
String str = "a";
int num=0;
int z;
void setup() {
size(400,400);
frameRate(25);
/* start oscP5, listening for incoming messages at port 8000 */
oscP5 = new OscP5(this,8000);
}
void draw() {
background(0);
}
void oscEvent(OscMessage theOscMessage) {
str = theOscMessage.addrPattern();
if(str.equals("/2/spdob") == true) {
println("forward"); //
} else {
println("static");
}
String addr = theOscMessage.typetag();
if(addr.indexOf(str) !=-1){
String list[] = split(addr,'/');
int xfader = int(list[2].charAt(5) - 0x30);
if(theOscMessage.get(0).floatValue() !=0){
fader[xfader] = theOscMessage.get(0).floatValue();
}
}
z = (round(fader[2]));
println(z);
//println(fader[1]));
//println(" typetag: "+theOscMessage.typetag());
}
i seem to have made a complete hash of it
any help would be most welcome
The road is hard to navigate when your blind and lost your stick !
regards
richard
1