Hallo, Libero Mureddu hat gesagt: // Libero Mureddu wrote:
Hi, here is a working example of the proportional canon patch. Now I have the following question: if I want to make this patch an abstraction, and use more instances of it, how to avoid duplications of the same "send", coll, etc?
I read the subpatch tutorial, but the mechanism is not really clear.
I don't know which tutorial you mean, but: subpatches are something completely different from abstractions, so a subpatch tutorial won't help you.
Hi, it is in Pd documentation browser - 2.control examples - 12.PART2.subpatch.pd It´s the documentation, not a tutorial, sorry, I mismatched the words.
Thanks a lot for your message, now the use of $0 is quite clear.
Regards,
Libero
Subpatches are objects -- [pd] or [page] -- while abstractions are
files: Abstractions have to be saved into their own file, then you can call them by their filename minus the .pd ending in another patch, also multiple times. When abstraction are used this way in another file, people often call various occurences of the same abstraction different "instances" of an abstraction.
In each instance of an abstraction and actually in every seperate patch file that you have opened, the special variable "$0" gets a unique value. (Note that "$0" can only be used in object names, not in message boxes.)
So to avoid duplicate names for s/r, you can use names with "$0" in your send/receive pairs:
| [s $0-local]
[r $0-local] |
This in practice is (almost) as local as a direct connection.
You can use the same approach for [table $0-local-array] or [catch~ $0-left]. For last year's versions of Pd (i.e. prior to 0.40) you have to start your name with $0 for this to work, while current 0.4x versions of Pd also allow $0 inside a name like [r pd-$0-name].
To get back to subpatches for a moment: $0 is only unique in whole patch *files* and in abstraction instances. If you use $0 in two subpatches, that live in the same file, they will have the *same* value for $0. You cannot create a sender that is local only in a subpatch with $0.
I don't know how [coll] deals with $0, I never use that object.
Ciao
Frank Barknecht _ ______footils.org_ __goto10.org__