[PD] How to get the size of the signal vector

Joseph A. Sarlo jsarlo at mambo.peabody.jhu.edu
Sun May 26 18:11:17 CEST 2002


> My question is: How can I get this value in PD, before I enter the
> dsp_perform routine i.e. at the external object's construction time,
> not only at processing time?  

Why is this necessary? The vector size in PD will be 64 unless it is
changed by a block~ or switch~ object. I'm not familiar with SndObj, but
you've said the vector size can be changed at runtime, so can't you just
initialize your SndObj vector size to 64 in the constructor and change it
later? It seems to me that you are going to have to check the block size
every DSP loop anyway to see if it's been changed, since block~ can change 
it while audio is turned on. So it doesn't really do you any good to know 
what the vector size is before audio is turned on, since someone can add a 
block~ object to their patch and change the vector size after.

> And a related question is: When does this value change and how do I
> recognize changes? I think, the [block] object changes the vector
> size, doesn't it?

I think all you need to do is give your object a property that holds
vector size and pass the s_n member of the t_signal struct that you get
from PD to your "perform" method (which you must be doing anyway). Then,
before the perform method loop, you can check that your object's vector
size and the PD vector size are equal and act accordingly. This is
basically what I did for my windowing function externals.

HTH

Joe
-- 
 ______________________________
|
| Joseph A. Sarlo
|
| jsarlo at mambo.peabody.jhu.edu
|______________________________








More information about the Pd-list mailing list