Get oscP5 working with Chinese message
in
Share your Work
•
2 years ago
//modified from oscP5message sample
import oscP5.*;
import netP5.*;
OscP5 oscP5;
NetAddress myRemoteLocation;
void setup() {
size(400, 400);
frameRate(25);
oscP5 = new OscP5(this, 12000);
myRemoteLocation = new NetAddress("127.0.0.1", 12000);
}
void draw() {
background(0);
}
void mousePressed()
{
OscMessage myMessage = new OscMessage("/test");
String hello = "你好世界";
myMessage.add(hello.getBytes());//<-----------------------
oscP5.send(myMessage, myRemoteLocation);
}
void oscEvent(OscMessage theOscMessage)
{
byte[] bts = theOscMessage.get(0).bytesValue();//<-----------------------
String n = new String(bts);//<-----------------------
println(n);
}