We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello! I'm scratching my head here trying to figure this out, trying to use booleanValue() in an oscEvent is giving me problems. When I run these together, program 2 gives me an Osc error. The interesting thing is that typetag() give "T" and "F" when program 1 is running with mouseClicks. Are these supposed to be type 'b'? I've dug through the java reference doc and haven't found anything, even the booleanValue() example code doesn't include booleanValue....
Thanks for any help with this.
I'll post both both codes I'm using to talk to each other for good reference:
Program 1:
import oscP5.*;
import netP5.*;
OscP5 clickSend;
NetAddress clickSendLocation;
boolean click = false;
void setup(){
size(200,200);
textAlign(CENTER);
fill(0);
clickSend = new OscP5(this, 5001);
clickSendLocation = new NetAddress("127.0.0.1", 6001);
}
void draw(){
background(255);
if (mousePressed){
click = true;
} else {
click = false;
}
if (click == true){
text("CLICK", width/2, height/2);
}
OscMessage clickMessage = new OscMessage("clickMessage");
if (click == true){
clickMessage.add(true);
} else if (click == false){
clickMessage.add(false);
}
clickSend.send(clickMessage, clickSendLocation);
}
Program 2:
import oscP5.*;
import netP5.*;
OscP5 clickGet;
NetAddress clickGetLocation;
boolean click = false;
void setup(){
size(200,200);
textAlign(CENTER);
fill(0);
clickGet = new OscP5(this, 6001);
clickGetLocation = new NetAddress("127.0.0.1", 5001);
}
void draw(){
background(255);
if (click == true){
text("CLICK", width/2, height/2);
} else if (click == false){
text("NO CLICK", width/2, height/2);
}
}
void oscEvent(OscMessage clickGetMessage){
println("Received message.");
println("addrPattern: "+clickGetMessage.addrPattern());
println("typetag: "+clickGetMessage.typetag());
println("booleanValue() = " + clickGetMessage.get(0).booleanValue());
if (clickGetMessage.get(0).booleanValue() == true){
click = true;
println("Click = true");
} else if (clickGetMessage.get(0).booleanValue() == false){
click = false;
println("Click = false");
}
}
Answers
had the same trouble here. i've given up and passed string instead of boolean.