oscP5 string problem with OscMessage
in
Contributed Library Questions
•
2 years ago
Hi,
I try to make a Scratch <> OSC bridge.
However have some problem to convert incoming string to a custom OSCMessage. It seems that OscMessage doesn't recognize the incoming part of the String.
String received from Scratch: sensor-update "position" -87.0
Could it be an encoding problem? Since Scratch encodes strings as UTF-8.
Or is it related to the library?
If you try it with Scratch don't forget to enable the remote connections. See this post.
Kasper
I try to make a Scratch <> OSC bridge.
However have some problem to convert incoming string to a custom OSCMessage. It seems that OscMessage doesn't recognize the incoming part of the String.
String received from Scratch: sensor-update "position" -87.0
Could it be an encoding problem? Since Scratch encodes strings as UTF-8.
Or is it related to the library?
- String receivedString = scratchClient.readString();
- println("incoming string: "+receivedString);
- String[] tokens = splitTokens(receivedString);
- String scratchMessageType = tokens[0];
- println("incoming scratch message type: "+scratchMessageType);
- // send OSC message
- //String sendOscString = "/scratch/"+scratchMessageType+"/"; // doesn't work
- String sendOscString = new String("/scratch/"+scratchMessageType+"/"); // doesn't work
- //String sendOscString = "/scratch/"; // works
- OscMessage myMessage = new OscMessage(sendOscString);
- myMessage.add(123);
- oscP5.send(myMessage, myRemoteLocation);
If you try it with Scratch don't forget to enable the remote connections. See this post.
Kasper
1