Hi list,
Having red as many mailing list posts as I could find, I didn't find how to use a local variable along with a creation time variable.
I have a [soundfiler] object which needs two arguements: the sample name and the array to load the sample to.
The abstraction is called with a creation time arguement, so the $1 is reserved. When I use the openpanel in order to receive the symbol (string) of the path of the .wav file I want to load, I cannot pass it as an variable value in no other variable than $1.
Is there a work around for this?
Thank you
Tasos
ΓñçóéìïðïéΓ₯ΓΓ΄Γ₯ Yahoo! ΓÑñΓ₯Γ¨ΓΓͺÑôΓ₯ ôÑ Γ₯Γï÷ëçôéΓͺà ìçΓΓ½ ìÑôÑ (spam); ΓΓ― Yahoo! Mail ÀéÑèΓΓ΄Γ₯Γ© ôçà ΓͺÑëýôΓ₯Γ±Γ§ ÀáΓÑôà ðñïóôÑóΓΓ‘ ΓͺÑôà ôùà Γ₯Γï÷ëçôéΓͺþà ìçΓáìΓôùà http://login.yahoo.com/config/mail?.intl=gr
Hallo, Tas Pas hat gesagt: // Tas Pas wrote:
Having red as many mailing list posts as I could find, I didn't find how to use a local variable along with a creation time variable.
I have a [soundfiler] object which needs two arguements: the sample name and the array to load the sample to.
The abstraction is called with a creation time arguement, so the $1 is reserved. When I use the openpanel in order to receive the symbol (string) of the path of the .wav file I want to load, I cannot pass it as an variable value in no other variable than $1.
I guess with "creation time variable" you mean what also or more often is called "creation argument", yes? (Creation) arguments are *only* evaluated in [object boxes], but not in [messages(. As you probably send a message to soundfiler, you can still use $1 in that message. Message $-variables are independent from abstraction arguments.
See attached example.
Frank Barknecht _ ______footils.org_ __goto10.org__
Hallo, Tas Pas hat gesagt: // Tas Pas wrote:
I have a [soundfiler] object which needs two arguements: the sample name and the array to load the sample to.
Ah, I had overlooked your attachements. There you test a lot of different things, which is a very good thing to do. To help you understand what's going on a bit:
If you have an abstraction, in your case "vars2.pd" and if you use this as [vars2 one], then every occurence of $1 at the start of a word inside every *object box* of vars2.pd will be replaced by "one", the first argument. So for example an object [table $1] will create a table called "one". In fact you can see the [table $1] as if you would have written [table one] in this case. An object [$1] will make Pd try to create an object called [one] which probably will be an unknown object and generate an error.
It is important to note, that only real *objects* are handled like this: the things you create with Put->Object, which I like to write as [object] in square brackets.
Occurences of $1 in *messages* like [a message with $1( are *not* replaced with the creation argument "one"! This is very important.
Dollars in message boxes are only replaced by something else, if this message box receives a message. How to replace the dollar-variable depends on the *incoming message* not on the abstraction's creation arguments. Sending a message "123" to the message from above will always make it send along "a message with 123", regardless of what else is going on in your patch.
Frank Barknecht _ ______footils.org_ __goto10.org__
I solved the problem I had storing the creation arguemet in an object. Then I packed the creation argument with the variable I got from the openpanel and send the list to the message I wanted to fill with the two variables.
What I noticed was that if I have a float for a creation arguement, I couldn't store it, because I had a [symbol $1] object waiting to store the $1-creation argument and that couldn't be created (it had a dicontinuous sqare).
Is there a way to know the type of the creation argument so that you can call an abstraction with any type of arguement you want, or is it a good tactic to put a [float $1] and a [symbol $1] waiting to store the argument so that you don't care if one of these fail to be created?
Regards,
Tasos
Frank Barknecht fbar@footils.org ΓãñÑøΓ₯: Hallo, Tas Pas hat gesagt: // Tas Pas wrote:
I have a [soundfiler] object which needs two arguements: the sample name and the array to load the sample to.
Ah, I had overlooked your attachements. There you test a lot of different things, which is a very good thing to do. To help you understand what's going on a bit:
If you have an abstraction, in your case "vars2.pd" and if you use this as [vars2 one], then every occurence of $1 at the start of a word inside every *object box* of vars2.pd will be replaced by "one", the first argument. So for example an object [table $1] will create a table called "one". In fact you can see the [table $1] as if you would have written [table one] in this case. An object [$1] will make Pd try to create an object called [one] which probably will be an unknown object and generate an error.
It is important to note, that only real *objects* are handled like this: the things you create with Put->Object, which I like to write as [object] in square brackets.
Occurences of $1 in *messages* like [a message with $1( are *not* replaced with the creation argument "one"! This is very important.
Dollars in message boxes are only replaced by something else, if this message box receives a message. How to replace the dollar-variable depends on the *incoming message* not on the abstraction's creation arguments. Sending a message "123" to the message from above will always make it send along "a message with 123", regardless of what else is going on in your patch.
Frank Barknecht _ ______footils.org_ __goto10.org__
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
ΓñçóéìïðïéΓ₯ΓΓ΄Γ₯ Yahoo! ΓÑñΓ₯Γ¨ΓΓͺÑôΓ₯ ôÑ Γ₯Γï÷ëçôéΓͺà ìçΓΓ½ ìÑôÑ (spam); ΓΓ― Yahoo! Mail ÀéÑèΓΓ΄Γ₯Γ© ôçà ΓͺÑëýôΓ₯Γ±Γ§ ÀáΓÑôà ðñïóôÑóΓΓ‘ ΓͺÑôà ôùà Γ₯Γï÷ëçôéΓͺþà ìçΓáìΓôùà http://login.yahoo.com/config/mail?.intl=gr
Hallo, Tas Pas hat gesagt: // Tas Pas wrote:
I solved the problem I had storing the creation arguemet in an object. Then I packed the creation argument with the variable I got from the openpanel and send the list to the message I wanted to fill with the two variables.
What I noticed was that if I have a float for a creation arguement, I couldn't store it, because I had a [symbol $1] object waiting to store the $1-creation argument and that couldn't be created (it had a dicontinuous sqare).
Is there a way to know the type of the creation argument so that you can call an abstraction with any type of arguement you want, or is it a good tactic to put a [float $1] and a [symbol $1] waiting to store the argument so that you don't care if one of these fail to be created?
You could use a [list append $x] to store both floats and symbols. Combined with [route float symbol] you can handle both cases of arguments in a single patch:
[loadbang] | [list append $1] | [route float symbol] | | | deal with symbols | do something with floats
However IMO it's better practice to define exactly what type you want to have at which position of the arguments. This way you will get better error messages if you do something wrong like trying to send a symbol to an object that only deals with float numbers or creating a [f O] object (that's an Oh, not a zer0 in the [f])
Frank Barknecht _ ______footils.org_ __goto10.org__