Forums > MaxMSP

patch a trigger


MJ
October 2, 2009 | 2:22 am

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

– Pasted Max Patch, click to expand. –


MJ
October 2, 2009 | 4:30 am

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
October 2, 2009 | 4:37 am

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…. Smile some late night maxxing here )


October 2, 2009 | 7:48 am

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

– Pasted Max Patch, click to expand. –

October 2, 2009 | 9:28 am

Something like this in a javascript maybe?

lh

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

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


October 2, 2009 | 9:39 am

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
October 2, 2009 | 1:27 pm

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<18; i++)
outlet(arguments[i]-1,"bang");
}

-mj


October 2, 2009 | 10:43 pm

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


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