[PD] pure-pd default creation argument mechanism
damian at frey.co.nz
Wed Oct 22 10:11:44 CEST 2008
i've built a [d-default] object which provides default arguments in case
creation arguments aren't specified. eg if you want $2 to have a default
value of 0.5, you can just say [d-default $2 0.5] - then if $2 is
specified, it will output $2 on load, otherwise it will output 0.5. have a
look at [d-default-help] in the attachment to my previous message (subject
'd-triad, d-note, ..') for an example.
at the moment, though, there is a problem, which is that the way the
defaulting mechanism works, you cannot override a non-0 default value with
0, since '0' is the value that $-arguments get if they are not specified.
i've tried replacing this with symbols. i want to get around this, if
possible, because it would be nice to be able to override non-zero
arguments with zeroes.
now, basically, inside [d-default] it works like this:
[sel 1 0]
[f $2] [f $1]
i tried replacing with symbols (as in [d-default-symbol]) (thanks to Chris
McCormick for this):
[f $1] [f $2]
but this doesn't work with overriding non-zero with zeroes either..
any advice appreciated :-)
damian stewart | skype: damiansnz | damian at frey.co.nz
frey | live art with machines | http://www.frey.co.nz
More information about the Pd-list