<div dir="ltr"><div>I put up a related 'enhancement' PR a bit ago for [inlet~] <a href="https://github.com/pure-data/pure-data/issues/259">https://github.com/pure-data/pure-data/issues/259</a><br><br></div><div>I dug into the ugen graph code a bit and got lost trying to implement it myself.. </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 6, 2018 at 9:22 AM, Miller Puckette <span dir="ltr"><<a href="mailto:msp@ucsd.edu" target="_blank">msp@ucsd.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This too is on my (almost infinitely long) dolist... to somehow extend the<br>
"dsp" message to allow objects to find out whether there are signals connected<br>
or not (and perhaps also to be able to deal with unequal-sized arrays somehow).<br>
<br>
Main reason I think this is needed is so that objects like "vcf~" can take<br>
audio signals to change "q" without always assuming they're audio (which<br>
would cause more overhead).<br>
<br>
cheers<br>
<span class="HOEnZb"><font color="#888888">Miller<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Tue, Mar 06, 2018 at 05:12:37PM +0100, Christof Ressi wrote:<br>
> the object doesn't know but the ugen graph algorithm does. if it sees that a signal inlet is not connected it creates a new signal and adds a scalar copy routine to the DSP chain.<br>
> the scalar value is stored in the inletunion in struct _inlet (m_obj.c) and it's updated whenever you send a float message to the inlet.<br>
> the first inlet is somewhat special in that you can use the CLASS_MAINSIGNALIN macro to store the scalar value directly in the class (usually named x_f).<br>
><br>
> have a look at ugen_doit in d_ugen.c:<br>
><br>
> if (!uin->i_nconnect)<br>
> {<br>
>     t_float *scalar;<br>
>     s3 = signal_new(dc->dc_calcsize, dc->dc_srate);<br>
>     /* post("%s: unconnected signal inlet set to zero",<br>
>        class_getname(u->u_obj->ob_pd)<wbr>); */<br>
>     if ((scalar = obj_findsignalscalar(u->u_obj, i)))<br>
>         dsp_add_scalarcopy(scalar, s3->s_vec, s3->s_n);<br>
>     else<br>
>         dsp_add_zero(s3->s_vec, s3->s_n);<br>
>     uin->i_signal = s3;<br>
>     s3->s_refcount = 1;<br>
> }<br>
><br>
><br>
> > Gesendet: Dienstag, 06. März 2018 um 16:08 Uhr<br>
> > Von: Alexandros <<a href="mailto:adrcki@gmail.com">adrcki@gmail.com</a>><br>
> > An: Pd-List <<a href="mailto:pd-list@lists.iem.at">pd-list@lists.iem.at</a>><br>
> > Betreff: [PD] How can a signal inlet of an object know if it's receiving a signal<br>
> ><br>
> > [phasor~] ([osc~], and probably other objects too) seems to be aware of<br>
> > signals being connected to its left-most inlet. Providing an argument to<br>
> > [phasor~], if there's no signal coming in its inlet, it will use its<br>
> > argument for the frequency. As soon as a signal is connected, it will<br>
> > use that signal for its frequency. As soon as this signal gets<br>
> > disconnected (even if the signal is 0), [phasor~] will go back to using<br>
> > its argument for its frequency.<br>
> ><br>
> > Reading [phasor~]'s code in d_osc.c, I can't understand how this is<br>
> > achieved. I thought of looking into canvasconnections.c from the iemguts<br>
> > library, but it's a bit too complicated for me. Still, there's this<br>
> > comment in that file:<br>
> ><br>
> > /* as Pd does not have any information about connections to inlets,<br>
> >      * we have to find out ourselves<br>
> >      * this is done by traversing all objects in the canvas and try<br>
> >      * to find out, whether they are connected to us!<br>
> >      */<br>
> ><br>
> > Does this have to do with control inlets only? How can [phasor~] know if<br>
> > it's receiving a singal in its frequency inlet?<br>
> ><br>
> ><br>
> ><br>
> > ______________________________<wbr>_________________<br>
> > <a href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list<br>
> > UNSUBSCRIBE and account-management -> <a href="https://lists.puredata.info/listinfo/pd-list" rel="noreferrer" target="_blank">https://lists.puredata.info/<wbr>listinfo/pd-list</a><br>
> ><br>
><br>
> ______________________________<wbr>_________________<br>
> <a href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list<br>
> UNSUBSCRIBE and account-management -> <a href="https://lists.puredata.info/listinfo/pd-list" rel="noreferrer" target="_blank">https://lists.puredata.info/<wbr>listinfo/pd-list</a><br>
<br>
______________________________<wbr>_________________<br>
<a href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list<br>
UNSUBSCRIBE and account-management -> <a href="https://lists.puredata.info/listinfo/pd-list" rel="noreferrer" target="_blank">https://lists.puredata.info/<wbr>listinfo/pd-list</a><br>
</div></div></blockquote></div><br></div>