Hi to all,
i've put this topic also in cycling74 forum because i don't know if it is a properly max/msp or processing question, anyway:
I'm starting to learn how communicate with Max/MSP and Processing. I've discovered first MaxLink libraries to do it, i've tried it and i found that it is now outdated and still unsupported so i'll go out with OSC (udpsend object) and oscP5 library in Processing to do the same things. So i've tried to learn how use Processing replicating and converting some easy examples of MaxLink libraries to oscP5, in particular the "shape_sketch" one, which send from max/msp a "bang" from /drawCircle, /drawSquare, /clear message objects to generate randomly 2D shapes in Processing, but i'm still newbie and i can't understand what is not working with oscP5, because, after i click that message objects in max/msp, in Processing nothing happens.
I'm asking if Processing can see a "bang" from max (like a string?), or i have to declare it in an other way. Processing has a similar max/msp "bang" function? The idea anyway is to use something that hit an ON value to "bang" an action, without use a streams of int or float values, like max/MSP does after clicking in a message object.
I'll attached here the Processing code:
import netP5.*; import oscP5.*; OscP5 link; void setup() { size(300, 300); background(250); noStroke(); smooth(); OscP5 link = new OscP5(this, 8080);
// declare the variable name and the setter function name link.plug(this, "drawCircle", "/drawCircle"); link.plug(this, "drawSquare", "/drawSquare"); link.plug(this, "clear", "/clear"); } void draw() { // must define draw function to // allow accurate future drawing } // these methods must be public public void drawCircle() { fill(0, 0, 240, 200); float r = random(50) + 5; ellipse(random(width), random(height), r, r); } public void drawSquare() { fill(50, 240, 50, 200); float w = random(50) + 5; rect(random(width), random(height), w, w); } public void clear() { background(250); }