Hallo, Hans-Christoph Steiner hat gesagt: // Hans-Christoph Steiner wrote:
I have written some classes for handling arguments when writing classes in Pd. They are [float_argument], [symbol_argument], and [any_argument]. Currently, I am thinking in general, inlets should be matched to arguments and vice versa,
"should match" would be oversimplyfiying, but having an extra inlet in the argument-patches never hurts.
so these objects all have a "convenience" right inlet, to attach the [inlet] to so that the data all comes from the [*_argument] object.
To use them, you add the argument you want it to handle like this:
[float_argument $1]
If you want a default value for when none is specified, you would do it like this:
[float_argument $2 234] [symbol_argument $3 default] [any_argument $9 asdf] [any_argument $5 444]
I attached "list_argument" which does the same as "any_argument" but doesn't require any externals and is much simpler than [any_arg...]. In fact, it's just [float_argument] where "float" is replaced by "list append".
Note that I would much prefer, if [list_argument] would be renamed to be [any_argument] and replace it.
Reason is: The name "list_argument" could lead to wrong expectations: It doesn't handle variable length lists as arguments, because that is impossible without externals like dollarg. It just handles one-element lists which get auto-converted to their respective type: "symbol x" or "float x".
Of course it won't work with Pd < 0.39.
Regarding symbol_- and float_argument: These could be implemented as:
[list_argument $1 $2] or [any_argument] | [route symbol] or [route float] | [outlet]
to share more code. Because Pd autoconverts one-element lists, there will always be a proper selector to make [route] do The Right Thing.
Frank Barknecht _ ______footils.org_ __goto10.org__