js observe clip added using "name" property

newtfish's icon

Hi,

In JS Im observing the "name" property of all clips in a track, but if a new clip is added there is no notification of this in JS. However, when using the live.observer object in max it at least outputs "empty".

Im wondering why this is? and if there is any way around it?

As a workaround im trying to observe the "has_clip" property of the clip_slot. However, I cannot observe both "has_clip" and "name" in the same function. Is there any way to share arguments across callback functions?

Cheers

newtfish's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Here is a demo of the problem. The JS version observes clip_slot 1 on track 1. Im expecting for something to be printed in the max window when I add a clip to clip_slot 0, or 1. The live.object is observing clip_slot 0 and it outputs "empty" , but with JS clip_slot 1, nothing gets printed.

And the JS

autowatch = 1;
outlets = 1;

names = [];

function bang() {

loadclips();

}

function loadclips() {

names = new LiveAPI(this.patcher, 1, clipname, "live_set tracks 0 clip_slots 1 clip");
names.property = "name";

}

function clipname(args) {
    post(args);
}

newtfish's icon

Anyone?

Its also frustrating/confusing that html tags cannot be included in a post, since these are used to denote an empty clip in maxforlive

Is there any way to share data across different callback functions, that are observing properties?