Hi all,
There's no way to get blocksize until DSP is turned on. The reason is that someone could add or change a block~ object after the object you're making gets created, so that it really isn't possible at creation time to know the size (or the sample rate either.) This causes some trouble in objects like send~ which can't know what size of internal buffer to make...!
cheers Miller
On Sun, May 26, 2002 at 12:11:17PM -0400, Joseph A. Sarlo wrote:
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@mambo.peabody.jhu.edu |______________________________