[PD-dev] Object crashes when trying to write to its outlet

Alexandros Drymonitis adrcki at gmail.com
Tue Oct 10 12:27:58 CEST 2023


Getting back here after a while, just to confirm that Christof was 
right. I would like to clarify if the following chunk is necessary to be 
placed in the dsp routine:

```
t_sample **dummy = x->in;
for (i = 0; i < x->inchnls; i++)
     *dummy++ = sp[i]->s_vec;
dummy = x->out;
for (i = x->inchnls; i < x->inchnls+x->outchnls; i++)
     *dummy++ = sp[i]->s_vec;
```

Without this the object crashes. From what I understand, the sp pointer 
contains the input and output samples, together with the block size, 
right? So, it's necessary to write the input and output to the pointer 
of pointers for the inlets and outlets.

Anyway, thanks for the help.

Alexandros

On 9/23/23 11:39, Christof Ressi wrote:
>
>> So you're saying that I only need to do the initial allocation, like 
>> this:
>>
>> `x->x_in = (t_sample **)getbytes(ninlets * sizeof(t_sample *));`
>>
>> and not try to allocate `t_sample *` bytes in the for loop? I did try 
>> this, but again the object is crushing.
>
> Yes, because "x_in" and "x_out" are supposed to hold the signal 
> vectors ("s_vecf") of the inlets and outlets, which you would assign 
> in the "dsp" method.
>
> Christof
>
>
>
>
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev





More information about the Pd-dev mailing list