Other examples would be zexy's [mux~] and [demux~].

is there a reason that cyclone/matrix~ is using dsp_add over dsp_addv?

Generally, you don't *need* to pass the individual signal buffers to dsp_add. Many externals with variable inputs/outputs simply allocate an array of t_float pointers inside the object and store the signal buffers there, meaning that they don't pass them to dsp_add at all. It's just a matter of personal style.

One word of warning about externals with multiple signal inputs/outputs (quoting from https://github.com/pure-data/externals-howto#signal-classes):

"Optimisation of the DSP-tree tries to avoid unnecessary copy-operations. Therefore it is possible, that in- and out-signal are located at the same address in the memory. In this case, the programmer has to be careful not to write into the out-signal before having read the in-signal to avoid overwriting data that is not yet saved."

This is still a bit vague, though, I would rephrase it like this:

"In this case, the programmer has to be careful not to write into *any* out-signal before having read *all* in-signals"

Christof

On 23.05.2020 09:21, Eric Lennartson wrote:
is there a reason that cyclone/matrix~ is using dsp_add over dsp_addv?

On Fri, May 22, 2020 at 8:26 PM Alexandre Torres Porres <[email protected] <mailto:[email protected]>> wrote:

    see the code of cyclone/mtx~ for instance

    basically, you do"
    for(i = 0; i < n_inlet; i++)
        inlet_new()...

    and stuff

    Em sex., 22 de mai. de 2020 às 23:17, Eric Lennartson
    <[email protected] <mailto:[email protected]>> escreveu:

        Hello all,

        I was wondering how one would go about creating an external
        that given two creation arguments created that many inlets and
        outlets? I've been browsing the source code for externals that
        do something similar, but I think I'm going to need a bit more
        of an explanation.

        Thanks for the help.
        _______________________________________________
        Pd-dev mailing list
        [email protected] <mailto:[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

Reply via email to