Forums > Javascript

How do I pass array-type arguments to Live API in JS?

July 9, 2010 | 2:00 pm

I’m desperately trying to enable/restore stop clip buttons on APC40 with JS LiveAPI:

...blabla..."set_stop_track_clip_buttons", ???????????);

Python implementation expects an array of button instances, so in Max/JS we can assume this function to expect something like a list of control id’s or a list of "id X"-type strings.. any ideas? So far anything I try leads to "invalid syntax" :/

Python definition, SessionComponent.pyc:

def set_stop_track_clip_buttons(self, buttons):
assert ((buttons == None) or (isinstance(buttons, tuple) and (len(buttons) == self._num_tracks)))
if (self._stop_track_clip_buttons != buttons):
if (self._stop_track_clip_buttons != None):
for button in self._stop_track_clip_buttons:

self._stop_track_clip_buttons = buttons
if (self._stop_track_clip_buttons != None):
for button in self._stop_track_clip_buttons:
assert isinstance(button, ButtonElement)
button.add_value_listener(self._stop_track_value, identify_sender=True)


July 24, 2010 | 5:45 pm

I have the same problem in trying to call the "note" method, which expects a list of 5 numbers after it.

seeing that with other methods which don’t require arguments the syntax is like this:"select_all_notes");

i’m not sure what we’re supposed to do when there ARE arguments.

the docs say:
The documentation says:

call (function(arguments…))
Calls the given function of the current object, optionally with a list of arguments.

but if the arguments to the "call" method are provided as a string (like the "select_all_notes" example above), then what to do when there are arguments?

Here are various failed attempts:

code:"note",64, 0 , 0.25, 100 , 0);

error in max window:
jsliveapi: Invalid syntax: ‘note 64 0 0.25 100 0′

code:"note","64 0 0.25 100 0");

error in max window:
jsliveapi: Invalid syntax: ‘note "64 0 0.25 100 0"‘

code:"note(64, 0, 0.25, 100, 0)");

error in max window:
jsliveapi: ‘Clip’ object has no attribute ‘note(64, 0, 0.25, 100, 0)’

Viewing 2 posts - 1 through 2 (of 2 total)