_______________________________________________Hi,
the problem is here:
signal_setmultiout() changes the signal pointer, so you must call it before assigning the signal pointer to the arg vector for dsp_addv()! Just swap these two lines and you should be good.
---
Some further notes:
1. I think you don't need x_outs at all when using dsp_addv(). The following lines are completely redundant:
2. Never ever send a Pd message directly from a perform routine! Always use a clock!
3. Why calloc/free instead of getbytes/freebytes? (In this particular case, it would also be safe to just use alloca())
Christof
On 09.08.2023 15:41, Alexandre Torres Porres wrote:
Ok, I tried building my new object and it crashes Pd as I expected.
Here's the original [xgate~] code, and I'm highlighting a specific line in it because the same thing in the "mc" version is what's crashing Pd.
and here's the [xgate.mc~] code, which is exactly the same thing https://github.com/porres/pd-else/blob/master/Code_source/Compiled/signal/xgate.mc~.c#L52
But now it seems "*x->x_outs[n]++" doesn't work. The only difference is that the outlets are now multichannel but Pd crashes even if the input is a single channel.
Not sure yet if it is something about "dsp_addv" not working for multichannels. I also suspect I need to adapt the code a bit in this case for some unknown reason to me.
please help
thanks
Em qua., 9 de ago. de 2023 às 00:57, Alexandre Torres Porres <porres@gmail.com> escreveu:
Hi, I am having a hard time using "dsp_addv" with a multichannel external.
I am trying to make a multichannel version of [else/xgate~], which routes a signal to different outputs with crossfading. It originally uses "dsp_addv" so it can have a DSP routine with a variable number of outlets, which is specified by an argument.
So now I want these outlets to output multichannel signals and I have run into trouble before trying to use "dsp_addv" with multichannel signals. I was able to avoid it before but now I can't and I wanna be sure before I try it.
thanks
_______________________________________________ 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