Hi Chad.
You can use "$0-". PD will replace it with an id (number) that is
unique for each instance of the patch. For example you can name your delay line "$0-delay".
[delread $0-delay]
.....
[delwrite $0-delay]
etc.
If you create 2 instances of you patch you will get something like "1023-delay" and "1024-delay".
Note that this mechanism is not generic (that is $0 is replaced this way only at the beginning of a string, do not try "this-is-my-delay-number-$0") and it doesn't work, on purpose, inside messages.
You can find more about this in the HTML manual (which explains many basic concepts of PD). And there are examples in the tutorial patches too.
It is the only way to make a local variable in PD but it works nicely.
HTH,
Maurizio Umberto Puxeddu.
On Thu, 2003-01-02 at 22:58, Chad Wood wrote:
Hello,
I have a problem... I'm implementing a simple comb filter subpatch that I can re-use. The subpatch uses a delay line. My problem is that if I have multiple instances of the subpatch in a larger patch, I have a naming conflict with the delay lines because they all have the same name. Right now I'm saving my patch as comb~.pd and invoking it as an abstraction. Is there a way to get around my problem without copying and pasting the patch every time I want to use it?
Thanks, this is my first post!
Chadwick
PD-list mailing list PD-list@iem.kug.ac.at http://iem.kug.ac.at/cgi-bin/mailman/listinfo/pd-list