hey,
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:
[loadbang] | [f $1] | [== 0] | [sel 1 0] | | [f $2] [f $1] | _____/ |/ [outlet]
i tried replacing with symbols (as in [d-default-symbol]) (thanks to Chris McCormick for this):
[loadbang] | [symbol $1] | [select $1] | | | [bang( | | [f $1] [f $2] | ________/ |/ [outlet]
but this doesn't work with overriding non-zero with zeroes either..
any advice appreciated :-)
cheers d
Damian Stewart wrote:
hey,
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.
ihaven't read your entire mail (due to lack of time), but how does this relate to the "empty creation argument" thread (http://lists.puredata.info/pipermail/pd-list/2008-10/065479.html) and the solution i posted there?
fgmadsr IOPhanens
IOhannes m zmoelnig wrote:
ihaven't read your entire mail (due to lack of time), but how does this relate to the "empty creation argument" thread (http://lists.puredata.info/pipermail/pd-list/2008-10/065479.html) and the solution i posted there?
sir, you're genius. thank you.
On Oct 22, 2008, at 5:50 AM, Damian Stewart wrote:
IOhannes m zmoelnig wrote:
ihaven't read your entire mail (due to lack of time), but how does
this relate to the "empty creation argument" thread (http://lists.puredata.info/pipermail/pd-list/2008-10/065479.html) and the solution i posted there?sir, you're genius. thank you.
-- damian stewart | skype: damiansnz | damian@frey.co.nz frey | live art with machines | http://www.frey.co.nz
There are already some abstractions for getting arguments, if you are
interested, but they don't include IOhannes' empty args hack yet. I
use them quite a bit, they are definitely useful. See any_argument,
float_argument, symbol_argument:
http://pure-data.svn.sourceforge.net/viewvc/pure-data/trunk/ abstractions/purepd/
.hc
The arc of history bends towards justice. - Dr. Martin Luther
King, Jr.
Damian Stewart wrote:
IOhannes m zmoelnig wrote:
ihaven't read your entire mail (due to lack of time), but how does this relate to the "empty creation argument" thread (http://lists.puredata.info/pipermail/pd-list/2008-10/065479.html) and the solution i posted there?
sir, you're genius. thank you.
hmm. actually, this isn't doing what i thought it was..
i don't really understand how it's working. what i want is an abstraction that is able to determine whether a given $-argument in its _parent_ is specified or not. at the moment, [d-default] works in such a way that i can go [d-default $2 50], and if $2 in the current-level patch (ie the parent of this instance of [d-default] is not specified, it will output 50.
can you explain the [1(-[makefilename $%d-test] voodoo? my intuition is that [makefilename] ought to outlet '$1-test', but according to [print] it's actually outputting \$1-test, which looks like some kind of funky escape sequence... over my head in any case.
cheers d