Problem receiving arguments from an OSC message (oscP5 + OSCulator)
in
Contributed Library Questions
•
2 years ago
Greetings from spain!
A stupid thing is making me mad :s. I am trying to read a couple of floats (pitch and roll axis of wiimote) from processing. For doing this I am using a sketch based on the example "oscP5oscArgument".
The big problem is that I can't "separate" the two values for using them in my sketch, so I receive this kind of message:
### received an osc message /wiimote with typetag ff. values: 0.51876163, 0.51876163
### received an osc message /wiimote with typetag ff. values: 0.577121, 0.577121
### received an osc message /wiimote with typetag ff. values: 0.51869893, 0.51869893
### received an osc message /wiimote with typetag ff. values: 0.57724977, 0.57724977
in which first and second arguments are totally equal.
Any help is really appreciated :(
I am sending the osc message from OSCulator, pitch is routed to arg[0] and roll is routed to arg[1], and my code is:
A stupid thing is making me mad :s. I am trying to read a couple of floats (pitch and roll axis of wiimote) from processing. For doing this I am using a sketch based on the example "oscP5oscArgument".
The big problem is that I can't "separate" the two values for using them in my sketch, so I receive this kind of message:
### received an osc message /wiimote with typetag ff. values: 0.51876163, 0.51876163
### received an osc message /wiimote with typetag ff. values: 0.577121, 0.577121
### received an osc message /wiimote with typetag ff. values: 0.51869893, 0.51869893
### received an osc message /wiimote with typetag ff. values: 0.57724977, 0.57724977
in which first and second arguments are totally equal.
Any help is really appreciated :(
I am sending the osc message from OSCulator, pitch is routed to arg[0] and roll is routed to arg[1], and my code is:
- /**
- * oscP5oscArgument by andreas schlegel
- * example shows how to parse incoming osc messages "by hand".
- * it is recommended to take a look at oscP5plug for an alternative way to parse messages.
- * oscP5 website at http://www.sojamo.de/oscP5
- */
- import oscP5.*;
- import netP5.*;
- OscP5 oscP5;
- NetAddress myRemoteLocation;
- void setup() {
- size(400,400);
- frameRate(25);
- /* start oscP5, listening for incoming messages at port 12000 */
- oscP5 = new OscP5(this,12000);
- myRemoteLocation = new NetAddress("127.0.0.1",12000);
- /* send an OSC message to this sketch */
- }
- void draw() {
- background(0);
- }
- void oscEvent(OscMessage theOscMessage) {
- /* check if theOscMessage has the address pattern we are looking for. */
- if(theOscMessage.checkAddrPattern("/wiimote1")==true) {
- /* check if the typetag is the right one. */
- if(theOscMessage.checkTypetag("ff")) {
- /* parse theOscMessage and extract the values from the osc message arguments. */
- float firstValue = theOscMessage.get(0).floatValue(); // get the first osc argument
- float secondValue = theOscMessage.get(1).floatValue(); // get the second osc argument
- print("### received an osc message /wiimote with typetag ff.");
- println(" values: "+firstValue+", "+secondValue);
- return;
- }
- }
- }
1