[PD] multiple [send] arguments

IOhannes m zmoelnig zmoelnig at iem.at
Thu Mar 10 15:45:01 CET 2016


On 2016-03-05 14:55, Liam Goodacre wrote:
> The only way I can see of using the right inlet to achieve a multiple send involves [list-drip] and one [float] object, which isn't very efficient.

why do you need it to be efficient.
don't get me wrong, efficiency is always a good thing;
but the use-case you gave is not something that will be executed each
sample-block: you wouldn't see the color-change each 1.5ms anyhow.
other use-cases (that do not involve GUI-objects) most likely can get
away with a cleaner design.
a pattern i regularily use is [route] and a special "all" selector (e.g.
"*"), as in:

[r channelgain]
|
[route *]
|       |
|       [route $1]
| +-----+
|/
|

and let "$1" be the unique ID of the object (e.g. "1" or "sub")


if performance is so important to you, a more efficient way is to use
different receive-labels

[r channelgain-*]
|
| [r channelgain-$1]
|/
|


(iirc, this is more efficient than a [send cg-1 cg-2 ...] could be.

>  It would also get more complicated if you wanted to send something other than floats

the examples above are agnostic of the actual messsages you send.

> --you'd have to use [any] which isn't Vanilla.

no. but [list] is.
it is very easy to mimicj [any] with [list prepend]+[list trim] (unless
you need to distinguish between "list"s with a symbol as the first atom,
and arbitrary messages (with any selector); it get's a bit more
complicated then as you need to distinguish between those two cases, but
it's still doable in a dozen or so vanilla objects.

> 
> You can already send to multiple locations using the [; message( method, but you have to spell the message out every time.

[list prepend set]+[list trim]?



in your case, however, i would just create a single messagebox that
sends the color-message to all the receivers:

[colorme, graphicr, savingr, safety, ujr, am, em, bm, foo, bar(
|
[pack s $0]
|
[addsemi, add2 $2-$1 color, adddollar 5, adddollar 5, adddollar 3(
|
[ (

([loadbang] this, make sure the [set( the final messagebox before adding
new receivers)

fgmasdr
IOhannes

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20160310/cf625c4c/attachment-0001.sig>


More information about the Pd-list mailing list