multi observer with js

frequenzteiler's icon

hi.
my js knowledge is very little but i figured how to observe multiple ids already .
i´d like to have an js object / observer thats capable of getting large lists of ids in its input, store those in an array, observe them and spit out the changed value and its id .got pointed in the right direction already but the script i wrote is crashing ableton when using track send ids and moving a send. maybe its also some inefficiency in the script i wrote . does not happen if i feed it with track_activator ids .
could someone else please have a look at that ?

here´s what i did:

inlets=1;
outlets=2;

function list()
{
var input;
if(inlet==0)
input=arrayfromargs(arguments); // makes an array called "input" from the input list
post("the list contains",arguments.length, "elements"); // how many elements ( ids ) has our input list
post(input[0]); // post the first element (id) just to check its working

var api = new Array();

for (n=0;n

frequenzteiler's icon

Never mind . Thank you apask. !!!
Works with all ids you feed it with ( as a list )

Here it is:

inlets = 1;

outlets = 2;

sendids = new Array();

prev = -1;

function list() {

    if (arguments.length) {

        nids = arguments.length;

        if (prev > nids) {

            sendids.length = 0;

            post("nids =", nids, "n");
        }

        prev = nids;

        for (i = 0; i < nids; i++) {
            sendids[i] = new LiveAPI(callback, "id "+arguments[i]);
            sendids[i].property = "value";
            sendids[i].id = "id";
        }
    }
    function callback(args)
    {
        outlet(0, args[1]);
        outlet(1, this.id);
    }
}
MartIn 's icon

this still works and is very useful, thanks!

frequenzteiler's icon

nice. with max 8 ? - i haven´t used it since version 6 i think .
what are you using it for ? you can easily modify it to observe other objects as well . if my memory is not wrong .

MartIn 's icon

i use it in maxforlive (Max 8.1.5) with Live 10. Now i just have to figure out how to use it on more than one device :)

My goal is to build a device that can save various states of all plug ins on a given track, Only changed values should be saved and recalled.

frequenzteiler's icon

since the id numbers are specific for every single object there is no need to change anything . i guess . except giving it a name to identify your observed data .
you might want to filter / group the ids after the object is spitting them out . this way you will have some kind of global observer for every device / id you are feeding in to it.
you might run into problems depending on how many ids you are feeding . processing wise.
i would create one multiobserver object per device to seperate the huge number of data you will get .

frequenzteiler's icon

during the time i was playing around with this there was a device made called kapture that has similar capabilities.

frequenzteiler's icon

https://www.ableton.com/de/packs/kapture/