[PD-dev] send vector length and sample rate to "DSP" methods?

Miller Puckette msp at ucsd.edu
Thu Jan 19 19:44:33 CET 2023


On another topic, I'm finding that if you make a multichannel ~ object with no
connections, it has no way to find the vector length which it needs in order to
create its outputs.

A multichannel object is (currently) required to create signals for all its
outputs (because Pd can't predict how many channels are desired), but when there's
no connection it then has to go back and ask the canvas (which it has to have
earlier stored a private pointer to) for the "length".  This is also rather bad
because the canva then has to go searching for any block~ object it might contain.
In short it's a mess.

What if the dsp() routines were called this way:

static void plus_dsp(t_plus *x, t_signal **sp, int length, float samplerate)
 ...

in place of the current:

static void plus_dsp(t_plus *x, t_signal **sp) 

I can't think of a downside to just adding the extra arguments; I think existing
"dsp" methods with the old declaration will work fine if Pd calls them with the
extra arguments.

Does anyone see a problem with this?  (or does anyone have a better suggestion)?

cheers
Miller





More information about the Pd-dev mailing list