<div class="postmsg">
                                        <p>Here's how I've managed to send and receive from a parent(multi
instance) abstraction to multiple instances of nested sub abstractions.<br><br>within main abstraction [mainAb]<br>some data named $0var send it like this [s $0var]<br><br>initialize sub abstractions<br>pass names X_1 and X_2 in so you can send and receive data to these abstractions individually<br>
[abX X_1 $0] [abX X_2 $0] <br><br>within sub abstraction abX initialized with X_1<br>$1 = X_1<br>$2 = mainAb's $0<br><br>for all instances of abX<br>to receive from main's [s $0var]<br>[r $2var]<br><br>to to send and receive locally and have mainAb access<br>
within abX [s $2$1varZ]<br>within mainAb [r $0X_1varZ] and [r $0X_2varZ]<br><br>a way to get global data to sub abstractions of abX<br>within abX initialize [abY $2var]<br>within abY $1var = mainAb $0var<br><br>This information is useful say if you have multiple voices and want to have them share the same control<br>
<br>so say $0var is a send on a filter frequency slider<br>when you move the slider all instances of abX receive the new filter frequency<br><br>when you want information to or from a specific instance of abX say like you want to plot each of the voices outputs on a scope <br>
use [s~ $2$1varZ] in abX<br>then in main [r~ $0X_1varZ] and [r $0X_2varZ] then you can write those to a table so you can see which voice is sounding</p>
                                </div>
                                <hr><br><br><div class="gmail_quote">On Tue, Mar 6, 2012 at 5:29 PM, Jonathan Wilkes <span dir="ltr"><<a href="mailto:jancsika@yahoo.com">jancsika@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
I was thinking about scope for receive/send names yesterday and<br>
<br>
thought of a way to implement something more flexible than<br>
<br>
(explicitly) using $0 to define the scope of send/receive pairs (and<br>
<br>
possibly other objects that register a symbol).<br>
<br>
My hack makes use of my "get" method for canvases patch:<br>
<a href="http://sourceforge.net/tracker/?func=detail&aid=3308027&group_id=55736&atid=478072" target="_blank">http://sourceforge.net/tracker/?func=detail&aid=3308027&group_id=55736&atid=478072</a><br>
<br>
Right now I'm seeing several categories, and I'm not sure how they all relate--<br>
<br>
meaning they may or may not require different approaches:<br>
1) _this_ canvas, basically what you would get if you prefixed the<br>
<br>
.x12345 name before the s/r symbol<br>
<br>
2) ways to break out of a canvas environment to the parent, parent of parent, etc.,<br>
<br>
all the way to toplevel<br>
3) ways to communicate among abstraction instances, including<br>
<br>
_this_ abstraction, all abstractions on the parent, parent of parent, etc., to toplevel<br>
<br>
4) ways to communicate among all libdir abstractions*<br>
<br>
5) global s/r names, abstraction global s/r names<br>
<br>
#1 is pretty simple-- just add an attribute for the canvas symbol to the "get" method,<br>
<br>
and prefix it to the s/r symbol.<br>
#2 is pretty simple, too-- just use integers to specify how far up the tree you want to<br>
<br>
go, get the $0 for that canvas environment, and prefix it to the s/r symbol.<br>
#3 is similar to #2, except that you also prefix the directory and filename with the $0<br>
#4 is like #3 except that you leave out the filename<br>
#5 global is nothing prefixed, abstraction global is the directory and filename with no $0<br>
<br>
I've made some abstractions [to] and [from] that can do the job for #1, 2, and global.<br>
($1 for level, $2 for the s/r symbol-- though I'm not sure if that's the best order)<br>
<br>
The question is do I also try to add the functionality for #3, 4, and abstraction global<br>
<br>
in those same objects, or do I make a [toabs]/[fromabs] pair for that purpose?<br>
<br>
In a way it'd be nice if there were a standard way to address all the possibilities above<br>
<br>
using only argument-- that way it'd be easy to add this functionality to already existing<br>
<br>
objects, like the array dialog and iemguis, with a single combobox (and simply default<br>
<br>
to whatever corresponds to global). The problem is that in both #2 and #3 a single float<br>
<br>
arg would be nice to specify the level so I'm not sure how to differentiate between the<br>
<br>
two.<br>
<br>
Also, are there any other contexts I haven't addressed in 1-5?<br>
<br>
<br>
-Jonathan<br>
<br>
* the only current example of this I can think of is inside the pddp libdir, where there's a<br>
<br>
global [v GLOBAL_PDDP_DSP] for the dsp status, but I'm not sure if it's used by anything<br>
<br>
other than ezoutput~.pd.<br>
<br>
<br>
_______________________________________________<br>
<a href="mailto:Pd-list@iem.at">Pd-list@iem.at</a> mailing list<br>
UNSUBSCRIBE and account-management -> <a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/listinfo/pd-list</a><br>
</blockquote></div><br>