patch a trigger

MJ's icon

hi

can someone point me in a direction where i can find a variable trigger object

To change the order of outputs of a trigger by a message

sending a "patch 6 4 3 5 2 1" message to such obeject would bang the fifth outlet after the third - or before depending starting right or left ...

like this patch but then variable

Max Patch
Copy patch and select New From Clipboard in Max.

MJ's icon

ha

just put some javascript together
put the js object in a subpatcher
and send a list to it " 1 2 3 5 4"

var outarray = new Array();
var def;
var inobject;

function list ()
{

var len = arguments.length;
var i=0;
this.patcher.remove(def);
this.patcher.remove(inobject);

inobject = this.patcher.newobject("inlet", 100 , 100 , 20 , 0);
def=this.patcher.newdefault( 100, 200, "bangbang", len);
this.patcher.connect(inobject,0,def,0);

for (i=0; i
{    
this.patcher.remove(outarray[i]);
    outarray[i]= this.patcher.newobject("outlet" , 100+i*30 , 340, 20 ,0);
    this.patcher.connect(def,arguments[i]-1,outarray[i],0);
}

}

MJ's icon

ah
no

does not work when removing the outlets the connection to the outside world of the subpatcher also disappears....

hmm have to put a dummy object in between

will do after some sleep (now its 06:30 AM.... some late night maxxing here )

jvkr's icon

Two solutions using standard objects. A wired version using router, and a wireless using forward.

Max Patch
Copy patch and select New From Clipboard in Max.

Luke Hall's icon

Something like this in a javascript maybe?

lh

// lh.vtrig
outlets = jsarguments[1] || 2;

function list() {
    a = arrayfromargs(messagename,arguments);
    for (i=0; i

Roman Thilenius's icon

instead of changing the order of 5 outputs, i would
change the content of the 5 variables.

the 5 messages would be stored as list inside and i
would trigger them by reading simgle elements from a
[zl nth] and route them by a [gate 5].

then any combination is possible.

-110

.

MJ's icon

ha

@jvkr
i like the wireless
but still a 'long' way to go from bang till print
and not easy to variable
in this example i used a list of 5 but that has to be variable

@lh
i tried such a thing too
but it does not seem to variable the number of outlets
do you have it working in a patch?

@roman
also the number 5 has to be variable
i do need to change order
but do you have this in a patch?

want to use this 'object' to change the drawing order of jit.matrix objects in a gl environment
which one has to be in front of the other in a variable way

this will do it with a fixed number

outlets = 18;
var i;
function list ()
{
for (i = 0; i
outlet(arguments[i]-1,"bang");     
}

-mj

Luke Hall's icon

Unfortunately you can't dynamically re-create inlets and outlets in the fashion you're looking for. However, if you set the argument to a large number at the beginning it will still work when you use lists of a smaller size.

lh