[PD] How can a signal inlet of an object know if it's receiving a signal

Alexandros adrcki at gmail.com
Tue Mar 6 16:08:04 CET 2018

[phasor~] ([osc~], and probably other objects too) seems to be aware of
signals being connected to its left-most inlet. Providing an argument to
[phasor~], if there's no signal coming in its inlet, it will use its
argument for the frequency. As soon as a signal is connected, it will
use that signal for its frequency. As soon as this signal gets
disconnected (even if the signal is 0), [phasor~] will go back to using
its argument for its frequency.

Reading [phasor~]'s code in d_osc.c, I can't understand how this is
achieved. I thought of looking into canvasconnections.c from the iemguts
library, but it's a bit too complicated for me. Still, there's this
comment in that file:

/* as Pd does not have any information about connections to inlets,
     * we have to find out ourselves
     * this is done by traversing all objects in the canvas and try
     * to find out, whether they are connected to us!

Does this have to do with control inlets only? How can [phasor~] know if
it's receiving a singal in its frequency inlet?

More information about the Pd-list mailing list