Routine in sc, with processing and osc

Hi all, I’m using osc communication to use SC and Processing at the same time. The stuff I’d like to do is to generate one routine (containing a soundfile) if I’m on the right side of the screen and another if I’m on the left side (with the mouse). until the moment of the trig everything works, but now I would like to understand how to stop the routine when the other one is activated and vice versa (perhaps with a nice fadeout). thanks :slight_smile:

Look into the Task class. It provides routines which can be started, stopped, paused, resumed.
Even one step further would be to look at Tdef as a way to dynamically create, start and stop tasks.