[PD] arguments not passed to an external
Miller Puckette via Pd-list
pd-list at lists.iem.at
Tue May 27 22:01:04 CEST 2014
> > Another important question I still have is, how do I determine whether
> >> there is a signal coming in the object's inlets, so I know whether to
> >> use the values passed via arguments, or the vectors passed from the dsp
> >> method. I'm asking the same thing over and over again...I'll stop for now.
> > I think if you get all zeros on the vector for the inlet you can assume
> > it's not connected. So use the argument values until you get non-zero on
> > the inlet vectors.
> I thought about that, but I do need to send zeros to the vectors some times
> (for example, raising a signal to a power, raising to the zeroth power will
> yield a DC of 1, which might be useful sometimes). Of course I can send
> signals with offsets and subtract the offset in the code, but I don't think
> this is good design. I'd rather not be able to use arguments.
Well, it's not pretty, but you can store the location of the inlet:
x->x_inlet1 = signalinlet_new(...)
and then pass it a message like this:
pd_vmess((t_pd *)x->x_inlet1, &s_float, "f", f);
I want to add an API to allow objects to find out which signal inlets are
actually connected (so you can write more efficient versions in case they
aren't) but haven't figured out how to do this cleanly yet.
More information about the Pd-list