live path and control surfaces - is it broken???

directgumby's icon

Hello,

Either the control surfaces are broken in the Live API and/or I am not clear on how to access them. I am working with the Live API in JavaScript and I am unable to access the Control Surfaces (and yes, I do have a control surface attached).

Here is the basic code:
autowatch = 1;

inlets = 2;
outlets = 2;

var api = undefined;

function test() {

// Trying to initialze the Live API to the control surfaces
var api = new LiveAPI(sample_callback, "control_surfaces 0");
// alternate way to try this given what the docs say... but may not be correct either
// var api = new LiveAPI(sample_callback, "live_app control_surfaces 0");
if (!api || api === undefined) {
post("no api object\n")
return
}
post("api", api, "\n");
post("api.id is", api.id, "\n");
post("api.path is", api.path, "\n");
post("api.children are", api.children, "\n")


}

function sample_callback(args) {
post("callback called with arguments:", args, "\n")
}

Here is the output:
js: callback called with arguments: id 0
js: api jsobject 101114064
js: api.id is 0
js: api.path is
jsliveapi: invalid index of component 'control_surfaces'
jsliveapi: Invalid syntax
js: api.children are 6 list elements, no children



From the docs here: https://docs.cycling74.com/max8/vignettes/live_object_model#ControlSurface

I read this:
A ControlSurface can be reached either directly by the root path control_surfaces N or by getting a list of active control surface IDs, via calling get control_surfaces on an Application object.
The latter list is in the same order in which control surfaces appear in Live's Link/MIDI Preferences. Note the same order is not guaranteed when getting a control surface via the control_surfaces N path.

My goal is to be able to listen to what happens on the sliders to understand what they are controlling. Currently I don't seem to be able to access much of anything with the LiveAP and the controllers.

Any thoughts, help, or suggestions here would be super helpful.

Thanks,
Brett