Forums > Max For Live

JS ClipSlot get("will_record_on_start") not working when clip exists

November 30, 2010 | 8:19 am

Hi everyone,

I currently dig more deep into Max and the Live API. For my current patch I switched to JavaScript for handling Live API communication and observing/getting properties. Currently I’m stuck on ClipSlot property "will_record_on_start". I observe a Tracks fired_slot_index property and has_clip property for the first two ClipSlots of it. In the callback for the Track observer I call get("will_record_on_start") for the fired ClipSlot.

This works fine for ClipSlots which do not have a Clip yet but as soon as a Clip exists I get:

jsliveapi: get: no property called ‘will_record_on_start’

According to the LOM I do not see why it behaves different depending on if there is a Clip or not.
Here is the simplified JavaScript to reproduce:

autowatch = 1;

var track_fired_slot_index;
var clip_slot = new Array();

function set_up(track) {

    track_fired_slot_index = new LiveAPI(this.patcher, track_observer_callback, "live_set", "tracks", track);
    if (!track_fired_slot_index)
    {
        post("no api object","n");
    }

    track_fired_slot_index.property = "fired_slot_index";

    for (slot = 0; slot < 2; slot++)
    {
        clip_slot[slot] = new LiveAPI(this.patcher, "live_set", "tracks", track, "clip_slots", slot);
        if (!clip_slot[slot])
        {
            post("no api object","n");
        }

        clip_slot[slot].track = track;
        clip_slot[slot].slot = slot;
        clip_slot[slot].property = "has_clip";
    }

}

function track_observer_callback(args) {
    post("track_observer_callback called with arguments:", args, "n");

    switch (args[0])
    {
        case "id":

            //
            break;

        case "fired_slot_index":

            fired_slot_index = track_fired_slot_index.get("fired_slot_index");
            if((fired_slot_index > -1) && (fired_slot_index < 2))
            {
                post("track_observer_callback will_record_on_start:", clip_slot[fired_slot_index].get("will_record_on_start"), "n");
            }

            break;
    }
}

function bang() {
    set_up(0);
}

I'm using the latest Version of both, Max and Live. Any idea why it behaves different?


November 30, 2010 | 4:34 pm

I don’t use javascript but merely the M4L objects (shouldn’t make a difference here) and I can confirm that clip_slot objects (‘class’) behave differently depending on whether it contains a clip or not.

If you use ‘getinfo’ (using live.object) on a clip_slot you’ll notice that it provides 3 extra properties when its empty, amongst which ‘will_record_on_start’. As soon as it contains a clip these properties no longer seem to be provided (resulting in an error; and even ‘getinfo’ doesn’t show them as available anymore).


November 30, 2010 | 4:51 pm

Ok, I would classify this as a bug than (or lack of Documentation, but that would not bring a fix for it).

Looks like I must workaround using Clip when Slot is filled and ClipSlot when it is empty. Is not nice but will work.


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