Possible to know if an outlet is connected or no?
hi
All is in the title I think,
have a nice day,
xxx
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?
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.
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 : )
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.