Forums > Dev

?argument-dependend inlet amount??

Jun 14 2008 | 7:27 pm

hi everybody! does anyone know how to make an object of which the amount of inlets is determined by an argument given.. for instance: ["objectname" 4] -> 4 inlets

would be nice if someone has some advice!!


Jun 15 2008 | 7:32 am

It depends on the type of object, if it’s an MSP, signal object you could just pass dsp_setup() your argument to create that number of inlets. Of course this would need some range checking and would require careful control over the dsp and perform routines since you would have a variable number of input buffers.

For regular, non-signal, objects I assume you’ve read Chapter 6 of the SDK pdf which gives you various options for creating inlets. I’d recommend using "proxies" (from p55-… in my copy of the SDK pdf). You could then allocate an array in your object struct large enough for your proxies (one less than the number of inlets). And then use a for loop (or while loop) to make the repeated calls to proxy_new().

In your object methods you would then be able to discover which inlet received the message which triggered the method using proxy_getinlet(). Again this is all detailed in the proxies section of the SDK pdf.

Jun 15 2008 | 9:26 am

thaaaaanks dude!!!! helps!!!

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

Forums > Dev