chick561
YaBB Newbies
Offline
Posts: 3
OSCp5 Help!
Jan 17th , 2008, 5:35pm
Hey there I am currently working on a project which uses max/msp to detect pitches and then uses the OSCp5 library in order to receive these pitches from max. The problem i am having at the moment is that i cant seem to beable to use the message sent in any way...EG i get the values into my comment box ok but when i try to implement them i cant seem to use them...im looking to beable to say //if(new value >47.8 && new value < 48.2); Obviuosly not like that but that overall idea. I probably have made a stupid mistake somewhere but any help would be much appreciated here is my sketch: import oscP5.*; import netP5.*; OscP5 oscP5; NetAddress myBroadcastLocation; Notes start,stop; Notes [] n; PImage bg; int a; PFont font; void setup() { size(1440,900); frameRate(30); /* start oscP5, listening for incoming messages at port 12000 */ oscP5 = new OscP5(this,12000); /* myRemoteLocation is a NetAddress. a NetAddress takes 2 parameters, * an ip address and a port number. myRemoteLocation is used as parameter in * oscP5.send() when sending osc packets to another computer, device, * application. usage see below. for testing purposes the listening port * and the port of the remote location address are the same, hence you will * send messages back to this sketch. */ myBroadcastLocation = new NetAddress("143.117.78.67",12000); start = new Notes(200,500); n = new Notes[1]; // The background image must be the same size as the parameters // into the size() method. In this program, the size of "milan_rubbish.jpg" // is 200 x 200 pixels. bg = loadImage("LCM-SCALES.jpg"); font = loadFont("Maestro-96.vlw"); textFont(font); fill(300); } void draw() { background(bg); start.draw(); } class Notes{ float x1,y1,x2,y2; Notes(float x, float y) { x1 = x; y1 = y; } void draw() { fill(0); text("q",x1,y1); textSize(120); } } /* incoming osc message are forwarded to the oscEvent method. */ void oscEvent(OscMessage theOscMessage) { /* get and print the address pattern and the typetag of the received OscMessage */ println("### received an osc message with addrpattern "+theOscMessage.addrPattern()+" and typetag "+theOscMessage.typetag()); theOscMessage.print(); } thanks matt