We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSound,  Music Libraries › specify incoming int sequence
Page Index Toggle Pages: 1
specify incoming int sequence (Read 988 times)
specify incoming int sequence
Jun 20th, 2009, 10:34am
 
hallo, as the object says I'm trying to specify the incoming ints in order to fire another message to be sent. this is the final part of my sketch, where the issue is, and it's been done with oscp5 library:

void oscEvent(OscMessage theOscMessage) {
 
  println("received a message.");
  if(theOscMessage.addrPattern().equals("/test") && theOscMessage.typetag().equals("iii") ) {            
  OscMessage o = new OscMessage("/pang");            
oscP5.send(o, myRemoteAddress);      
}


so everything works so far, when /test message with three ints reaches the incoming port, a /pang message is sent to myRemoteAddress. this is what I wanted to achieve.
The only thing that i'm missing is to specify the values of the three ints. so assuming that the message that I need in order to fire /pang is:

/test  int=1 , int=2, int=3

I tried to substitute the ("iii") with (123) and also (1,2,3) but it didn't work. so the question is, how can I specify the incoming int  values to fire /pang message, so I can be even more specific?

thanks

p.s. I tried parsing method also but with no luck
Re: specify incoming int sequence
Reply #1 - Jun 23rd, 2009, 6:58am
 
anyone? please? Cry
Re: specify incoming int sequence
Reply #2 - Jun 23rd, 2009, 9:15am
 
hi,

i hope i understand your problem right

you can access the int values of a message by

int first = theOscMessage.get(0).intValue();
int second = theOscMessage.get(1).intValue();
int third = theOscMessage.get(2).intValue();

and add them to your second message by calling

OscMessage o = new OscMessage("/pang");
o.add(first);
o.add(second);
o.add(third);

Re: specify incoming int sequence
Reply #3 - Jun 23rd, 2009, 2:42pm
 
@ whom it may concern

Thnks to Guru, this is what I was looking for:

if (theOscMessage.addrPattern().equals("/test") &&
theOscMessage.typetag().equals("iii") ) {
int a = theOscMessage.get(0).intValue();
int b = theOscMessage.get(1).intValue();
int c = theOscMessage.get(2).intValue();

if ( a == 1 && b == 1 && c == 1 ) {
OscMessage o = new OscMessage("/pang");
oscP5.send(o, myRemoteAddress);
}
}
Page Index Toggle Pages: 1