[PD-dev] is "dsp_addv" ready for multichannel?
Christof Ressi
info at christofressi.com
Wed Aug 9 17:07:12 CEST 2023
Hi,
the problem is here:
https://github.com/porres/pd-else/blob/2d53dfa7bd02b1fd102dbad7a2f9799df0a32e37/Code_source/Compiled/signal/xgate.mc~.c#L67-L68
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:
https://github.com/porres/pd-else/blob/2d53dfa7bd02b1fd102dbad7a2f9799df0a32e37/Code_source/Compiled/signal/xgate~.c#L41-L42
2. Never ever send a Pd message directly from a perform routine! Always
use a clock!
https://github.com/porres/pd-else/blob/2d53dfa7bd02b1fd102dbad7a2f9799df0a32e37/Code_source/Compiled/signal/xgate~.c#L50-L55
3. Why calloc/free instead of getbytes/freebytes? (In this particular
case, it would also be safe to just use alloca())
https://github.com/porres/pd-else/blob/2d53dfa7bd02b1fd102dbad7a2f9799df0a32e37/Code_source/Compiled/signal/xgate~.c#L67-L72
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.
>
> https://github.com/porres/pd-else/blob/master/Code_source/Compiled/signal/xgate~.c#L57
>
> and here's the [xgate.mc <http://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 at 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 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/20230809/4a485bdf/attachment.htm>
More information about the Pd-dev
mailing list