Both of you were right. The 2 wasn't necessary, and indeed, I forgot to multiply by the element type.
Thanks for the casting to t_int tip, wasn't aware of that.
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@lists.iem.at https://lists.puredata.info/listinfo/pd-dev
_______________________________________________ Pd-dev mailing list Pd-dev@lists.iem.at https://lists.puredata.info/listinfo/pd-dev