Thanks Christof! I can swear that at one point I tested something like this by first setting the channels, but I'm of course mistaken ;)
Em qua., 9 de ago. de 2023 às 12:08, Christof Ressi <[email protected]> escreveu: > 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~] 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 < > [email protected]> 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 > [email protected]https://lists.puredata.info/listinfo/pd-dev > > _______________________________________________ > Pd-dev mailing list > [email protected] > https://lists.puredata.info/listinfo/pd-dev >
_______________________________________________ Pd-dev mailing list [email protected] https://lists.puredata.info/listinfo/pd-dev
