Is it possible to get object connection?

Martin.Jirsak's icon

Hi,

Can retrieve an information about any object connection via JavaScript?

Let's say I have a [bang] object (or [pack], [ctlin],... whatever), can I do something like this.patcher.getnamed('myBang').get connection(), please?

I would like to know, if the inlets and outlets are connected (in the best way even to get the source or the destination of the connection; but at first to know, of it is connected at all).

Thank you!

tyler mazaika's icon

Yes. Maxobj class has a ‘patchcords’ attribute.

Martin.Jirsak's icon

Oh, that's great!

The example is like this:
var connection = myBang.patchcords

This returns an object of inputs and outputs arrays where you can see the srcobject, srcoutlet, dstobject and dstinlet. Very cool!