Processing and supercollider with OSC

Hi everyone, I’m trying to make Processing and Supercollider communicate with each other, via OSC. I would like to be able to achieve the following thing: by moving to either the left or right side of the screen in processing, I would like supercollider to start one routine rather than another. it’s possible?

Yes, it is possible and is piece of cake to do it:

Also take into consideration that if you use a continuous output from processing (e.g. the coordinateX of the mouse) you will probably need to either map it to continuous synth paramenter (e.g. pitch, amplitude, etc) or to extract a trigger out of it (e.g. if you map the mouseX from pocessing to a routine that creates synths you will probably get too many nodes and make the client to crash).

If you’re just interested in when the mouse crosses this boundary, I would do the checking in Processing and when the ‘state’ changes, send a single OSC message to SC to convey the new state and change the routine based on that. I try to keep less OSC flying around when possible!