[PD-dev] dynamically allocate memory for object structure component

Miller Puckette msp at ucsd.edu
Sun Sep 14 17:26:41 CEST 2014


That's right.  Block size can change after an object is created so block-sized
allocations are best put in the "dsp" routine that's called whenever DSP is
started.  (If a block~ changes its blocksize via a "set" message, DSP is
re-started.)

cheers
Miller

On Sun, Sep 14, 2014 at 08:20:25AM -0700, Jonathan Wilkes via Pd-dev wrote:
> Yes, I see: sys_getblksize
> 
> in m_pd.h.
> 
> It looks to be hard-coded to return 64.
> 
> Of course the block size for a subpatch can be changed with [block~].  I'm not totally comfortable with the dsp operations yet, but it looks like that block size is what is represented by the member s_n of t_signal.  But one of the dsp gurus should probably confirm or deny that. :)
> 
> 
> -Jonathan
> 
> 
> 
> On Sunday, September 14, 2014 5:18 AM, Alexandros Drymonitis <adrcki at gmail.com> wrote:
>  
> 
> 
> I writing an external where I want to declare some arrays in the object structure which will have the size of the block size. I want to allocate memory using malloc with a variable that gets the block size. I know it's possible to get the sample rate with sys_getsr(); which can be used in the new instance routine. Is there something similar that gives you the block size?
> 
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at lists.iem.at
> http://lists.puredata.info/listinfo/pd-dev

> _______________________________________________
> Pd-dev mailing list
> Pd-dev at lists.iem.at
> http://lists.puredata.info/listinfo/pd-dev




More information about the Pd-dev mailing list