hi federico
"Federico" xaero@inwind.it wrote:
Hello list!
I am trying to follow some general standards while writing abstractions with pure-data. One of these, is the habit of prepending $0- to send/receives, so that it is possible have more than one instance of an abstraction.
All it is ok except when I use arrays in my abs.
i tried to use the message: ; $0-myarray resize $1;
this won't work, since you send [resize <$1>( to 0-myarray. try the following instead:
[nbx]
|
[t b f]
|
[pack $0 f]
|
[; $1-myarray resize $2(
dollarsigns in message-boxes are not the same as in objects. in message-boxes they are used to get a certain element from a list, whereas in objects they are representing an argument.
or even: [nbx] | [resize $1( | [s $0-myarray]
this is actually the same as my example from above. i assume it does not work, because the $0-array is in an abstraction. abstractions do NOT have the same $0-value as their parent patch. if you want to send data to an array in an abs, but you still want to have your mainpatch using localized symbols, you could do the following: create your abstractions with the argument $0 -> [yourabs $0]. then replace within your abstraction all $0's with $1's, e.g. $0-myarray -> $1-myarray. now you can send data from your mainpatch to your abstraction using $0-myarray. of course, every $1-myarray will receive the data.
but pd outputs rispectively: error: 1002-sample: no such object error: 0-sample: no such object
how I can resize arrays inside multi-instance abstractions?
if i understand you right, you want to have independent arrays in each abs, but you want resize them altogether. in this case just leave all arrays with the $0-prefix. then you could make some kind of master-resize-send in your mainpatch:
[nbx] | [s resize-all]
then in your abs you need to 'forward' the message:
[r resize-all] | [resize $1( | [s $0-myarray]
i hope i could help. roman
___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de