[PD-dev] external crashing when block size changes

Christof Ressi info at christofressi.com
Tue Sep 19 22:17:06 CEST 2023


> what is this "2" supposed to represent? 
This looks like a mistake to me. The buffer certainly does not have to 
be twice as large, as it is only used to copy the input.

To solve the mystery, you don't allocate the right amount of memory 
because you forgot about the element type:

x->bufbytes = x->chnls * sp[0]->s_n * sizeof(t_sample);

BTW, "bufbytes" is a bit redundant, as you can just calculate it from 
"x->blksize".

---

> dsp_add(var_io_tilde_perform, 2, x, sp[0]->s_n);

ALWAYS cast integers to "t_int" before passing them to "dsp_add"; 
otherwise it might crash on certain platforms. Here's the correct version:

dsp_add(var_io_tilde_perform, 2, x, (t_int)sp[0]->s_n);

Christof

On 19.09.2023 20:33, IOhannes m zmölnig wrote:
> On 9/19/23 20:02, Alexandros Drymonitis wrote:
>>          x->bufbytes = x->chnls*2*sp[0]->s_n;
>
> what is this "2" supposed to represent?
>
> mfdsar
> IOhannes
>
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20230919/a898002d/attachment.htm>


More information about the Pd-dev mailing list