Forums > MaxMSP

Variable Number of Outlets?

November 7, 2008 | 9:42 pm

Hi – I’m looking to make an abstraction with a variable number of outlets, the way [sel] and [gate] have. How do I do this? I assume it’s with [thispatcher], but my experience with this object is limited to [bpatcher] offset messages. Thanks for any help!


November 7, 2008 | 10:03 pm

You need to create them with scripting messages to [thispatcher]. Depending on what function your abstraction provides, this might make it a bit annoying/difficult. One thing to remember is that creating new outlets every time a patch is loaded will mean all the connections from your abstraction in the patch that it is contained in will be destroyed. Not good. The way I get around this is to include a number of outlets with scripting names in the patch from the start and then delete the unneccesary ones using scripting when the abstraction is loaded. This means connections will be maintained but you do have a maximum number of outlets to work with. There’s an example of what I mean in the patchbay abstraction I posted in this thread:

http://tinyurl.com/5hn2qq

I hope it helps and would be interested in hearing how other people go about doing this.

lh


November 9, 2008 | 10:24 am

Luke schrieb:
> I hope it helps and would be interested in hearing how other people
> go about doing this.

It seems the only way to go, I do it all the time.

To avoid multiple ins and outs with audio I set up a framework which
works with multicores…

The multicore~, and route~ objects use the inlet/outlet removing
technique and are limited to 24 at the moment…

Stefan

multicore~:

– Pasted Max Patch, click to expand. –

route~:

– Pasted Max Patch, click to expand. –

grandgate.js:

outlets = 2;
intlets = 1;

function anything()
{
var a = arrayfromargs(messagename,arguments);
if(this.patcher.parentpatcher.parentpatcher){
outlet(0, a);
}
else{
outlet(1, a);
}
}

multicore~.maxhelp:

– Pasted Max Patch, click to expand. –


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


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