I posted this in another thread but it was a bit of a hijack.
How exactly do we access the live objects from javascript? I'm wanting to make a clip launcher and some monome framework using javascript as this should be slightlier simpler than graphically patching it.
Ive tried for example:
path = new LiveAPI('live.path')
which just results in max crashing.
Are these features implemented and not documented or just not quite there yet?
live objects in javascript
Re: live objects in javascript
Try this shared by Jeremy from Cycling:
http://pastie.org/627540
http://pastie.org/627540
var api = new LiveAPI(this.patcher /*required */, callback_fun /*optional*/, "initial_path to some live_thing" /*optional*/);
functions:
getcount [some_child]
goto [some_path]
get [some_property]
getstring [some_property]
set [some_property]
call [some_function]
properties:
id: r/o, int
path:
set: string or array (only 1 path, though)
get: string (current path)
children: r/o, array
mode: [ignore for now]
type: r/o, string (type of current path)
info: r/o, string (info of current path)
property:
set: string
get: string (observed property)
proptype: r/o, string (observed property type)
The callback argument in the constructor function can be used to specify a JS function which will be called when the object's id changes (when setting a new path, or in 'object follows path' mode (currently broken, don't worry about it yet)) or when an observed property changes. See the attached .js for a usage example.
Please let me know how it goes. The object appears to be nice and stable at this point, so it would be worth spending some time with it.
New builds should be out soon, so keep an eye out!
Jeremy
Re: live objects in javascript
cheers, just what i was looking for!