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 & HelpIntegration › processing and SC3 via oscP5
Page Index Toggle Pages: 1
processing and SC3 via oscP5 (Read 1393 times)
processing and SC3 via oscP5
May 12th, 2005, 11:34am
 
Hi,
I just started with processing, and am attempting to communicate with SC3. I can send messages OK, (
that is

println("you have received a message "+
               oscIn.getAddrPattern()+
               "   argument 2 = "+arg2+"   argument 3 = "+arg3
        )Wink

works, and the args+message are printed out on the screen.
However trying to create a shape object, such as a small rectangle fails (that is, nothing happens). I am just attempting to use the oscP5_receive.pde straight out of the box. The SC3 code which sends three integers to pass as values to fillrect(int, int, int) is below. Could someone please explain to me why this fails, and what I may do to fix it?

sincerely,
vesa.

///////////////////////////////
/*SC3 code*/
(

var process, r;
process = Server.new("aServer", NetAddr("localhost", 12000));

r = Routine.new({
     //5.wait;
     5.do({arg a;
           process.sendMsg("/test", 30, 20, 55);
           1.wait;
           });
     1.wait;
     "done".postln;
});
SystemClock.play(r);
)
Re: processing and SC3 via oscP5
Reply #1 - May 12th, 2005, 6:37pm
 
hi vesa,

try this. worked for me with your sc script. sending the 3 integers will fill the frame with the 3 integers as rgb values.

import oscP5.*;

OscP5 oscP5;
int receiveAtPort;
int sendToPort;
String host;
String oscP5event;

void initOsc() {
       receiveAtPort = 12000;
       sendToPort = 57120;
       host = "127.0.0.1";
       oscP5event = "oscEvent";
       oscP5 = new OscP5(
               this,
               host,
               sendToPort,
               receiveAtPort,
               oscP5event
               );
}


void oscEvent(OscIn oscIn) {
       println("received ...");
       if(oscIn.checkAddrPattern("/test")) {
         int r = oscIn.getInt(0);
         int g = oscIn.getInt(1);
         int b = oscIn.getInt(2);
         fillrect(r,g,b);
       }
}

void fillrect(int theR, int theG, int theB) {
 fill(theR,theG,theB);
 rect(0,0,400,400);
}


void setup(){
       size(400, 400);
       background(255);
       initOsc();
}

void draw() {
}
Re: processing and SC3 via oscP5
Reply #2 - Aug 8th, 2006, 8:32pm
 
i'm a newbie and i've downloaded a vvvv patch that communicates with processing via osc to make blobtracking. the problem is in the sketch:

i get an error on oscIn.getDataList().size()  ---> no accessible method found...what is the problem? isn't it a correct method?

thank you

Pietro
Re: processing and SC3 via oscP5
Reply #3 - Aug 9th, 2006, 12:30am
 
hi piede828,
you are probably using the new version of oscP5. i made quite a few syntax changes to this version. to get the size of the data list which is the list of arguments sent to oscP5 try using the following method in your sketch

void oscEvent(OscMessage theOscMessage) {
 println(theOscMessage.arguments().length);
}

which will give you the size of the arguments (the data list). the return type of theOscMessage.arguments() is of type Object[]  

best,
andi
Re: processing and SC3 via oscP5
Reply #4 - Aug 9th, 2006, 11:49am
 
yes, you're right i was using the newest version that has OscIn no more.

i'll try with that. thanks!
Page Index Toggle Pages: 1