Page 2 of 2

Re: OSC API through Max

Posted: Thu Nov 12, 2009 8:02 pm
by willrjmarshall
@mzed

I'm still too new to Max to be of much help. If you look at the Max for Live docs within Max, they have an API for the LOM, that should give you all the info you need.

Re: OSC API through Max

Posted: Thu Nov 12, 2009 9:15 pm
by Tone Deft
I'm not up to speed on this level of coding but wanted to give a shout out to OSC for midi sync via the API.

Re: OSC API through Max

Posted: Thu Nov 12, 2009 10:28 pm
by pukunui
My personal feeling about this type of endeavour is that an easier way to do it would be to build a big observer structure in js using callbacks for track creation, clip adding, device addition and what have you and take it from there. You could handle all the OSC in there as well, or push out [path, id] pairs.

Any attempt at a generalisation which ends up having to make a call to live.path any time something happens will end in tears, IME

-A

Re: OSC API through Max

Posted: Fri Nov 13, 2009 12:16 am
by mzed
Indeed. As much as I love string handling in Max, I'm finding this kind of javascript has more potential:

Takes a message like: "OSC /live_set/tracks/0/mixer_device/volume 0.5" and forwards it to the appropriate API address.

mz

javascript below
-=-=-=-=-

outlets =1 ;

var vpattern = "/";
var vmodifier = "g";
var vregexp = new RegExp(vpattern,vmodifier);
z = " ";

var api = new LiveAPI(this.patcher);


function OSC(address,value)
{
var r = address.replace(vregexp,z);
r = trimString(r);
api.path = (r);
api.set("value", value);
name = api.getstring("name");
post(name,"has been set to",value,".\n");

outlet(0,r);
}

function trimString (str) {
str = typeof this.valueOf() == 'string' ? this : str;
return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

Re: OSC API through Max

Posted: Fri Nov 13, 2009 12:40 am
by willrjmarshall
The LiveAPI implementation can be seen at http://monome.q3f.org/wiki/LiveOSC

There are some things we could improve on, but it gives you all and idea.

Re: OSC API through Max

Posted: Mon Nov 16, 2009 10:59 pm
by t0gg1e4u
Are there more infos available regarding the api for js?