can patcher find out what it's outlet is connected to?
is there any way, from inside a patcher file, to get any info about whether or not it’s outlets/inlets are connected in the parent patch? thanks.
not at all, at least not non-idiosyncratic.
First of all, you should think carefully if you really want to do this. A situation where a patcher needs to know what its outlets are attached to is breaking the vaguely-object-oriented, black-box model patchers in Max/MSP follow. I’m not trying to be the thought police, I’m just saying that the patching model where you do this tends to create more problems then it solves.
Believe me, I’ve done this with externals I’ve developed, and lived to regret it.
One way to get this information is to have your object send a special ‘request’ message through its outlets that the recipient objects reply to by sending a ‘response’ message. So you’ve got to build the recipient objects to respond in some way. As a practical matter, the request message will include a symbol identifying the sender and the responding objects will use that identifier to set the target of a [forward] object to use for sending the responses.
It’s all pretty fragile. And, obviously, will only work with patchers that you’ve built to handle your request/response protocol.
You could also read in the source text of the parent patcher and write a parser. Though there is not too much documentation about the format, its much more readable since Max 5 and pretty self explanatory.
2. read the source.
3. parse for "patching_rect" of your object.
4. go back to until you get the id of your box.
5. search for patchline destinations with your id as source.
If there is none, its not connected.
I bet its not worth the hassle…
What are you after, that you need it? There might be better ways to achieve the same…