Possible to know if an outlet is connected or no?

Dec 4, 2012 at 1:32am

Possible to know if an outlet is connected or no?

hi

All is in the title I think,

have a nice day,

xxx

#65487
Dec 4, 2012 at 7:51am

Technically “yes” but it involves feeding the JSON of the patch into itself to parse. There might be a better method so why do you need to know? And are you checking for a Max connection or an MSP connection?

#235954
Dec 4, 2012 at 6:40pm

Well, are you talking about from within an external (in C), or via Javascript or Java or by patching?

The C API does not provide for this. You can try to hack the outlet data structure, but that’s playing with fire and anything you figure out today is likely to break in the next release or two (or sooner).

Standard question: why do you need to know? If you need to know, you’re not thinking OO.

#235955
Dec 11, 2012 at 2:01pm

I was needing to know for optimisation, avoid some treatment if that’s useless because i don’t use the outlet.
thank for your answer : )

#235956
Dec 11, 2012 at 3:06pm

What you can do (and relatively easily) is let the user specify at instantiation time (ie, with an argument) whether the outlet is needed.

This would be a similar strategy to [route] and [sel] where the user specifies how many outlets to create via instantiation arguments. If the user doesn’t create the outlet, it doesn’t need to be calculated.

This is probably not the flexibility you were hoping for, but it might be a strategy worth considering.

#235957

You must be logged in to reply to this topic.