Revision: 10171 http://pure-data.svn.sourceforge.net/pure-data/?rev=10171&view=rev Author: eighthave Date: 2008-07-17 21:45:38 +0000 (Thu, 17 Jul 2008)
Log Message: ----------- fixed bug where arguments didn't work, caused by setting the default first argument to 0. float_argument can't tell the difference between an argument that is set to 0 and an empty argument that is initialized to 0
Modified Paths: -------------- branches/pd-extended/v0-40/externals/mapping/autoscale.pd branches/pd-extended/v0-40/externals/mapping/help/autoscale-help.pd
Modified: branches/pd-extended/v0-40/externals/mapping/autoscale.pd =================================================================== --- branches/pd-extended/v0-40/externals/mapping/autoscale.pd 2008-07-17 08:18:05 UTC (rev 10170) +++ branches/pd-extended/v0-40/externals/mapping/autoscale.pd 2008-07-17 21:45:38 UTC (rev 10171) @@ -1,4 +1,4 @@ -#N canvas 722 218 702 488 10; +#N canvas 137 61 702 488 10; #X obj 35 20 inlet; #X obj 184 424 outlet; #X obj 184 321 expr (($f1 - $f2) * (($f5 - $f4) / ($f3 - $f2))) + $f4 @@ -13,35 +13,58 @@ #X text 466 6 output max; #X text 74 21 data to be scaled; #X obj 552 20 inlet reset; -#N canvas 691 127 481 311 output 0; +#N canvas 691 127 484 377 output 0; #X obj 6 23 inlet; #X obj 294 25 inlet; -#X obj 6 270 outlet; -#X obj 177 273 outlet; -#X text 62 270 min; +#X obj 6 330 outlet; +#X obj 177 333 outlet; +#X text 62 330 min; #X text 48 24 min; #X text 340 27 max; -#X text 225 273 max; +#X text 225 333 max; #X obj 38 53 loadbang; -#X obj 6 216 expr if ($f1 == $f2 , 0 , $f1) ; if ($f1 == $f2 , +#X obj 6 276 expr if ($f1 == $f2 , 0 , $f1) ; if ($f1 == $f2 , 1 , $f2); #X text 153 71 [float_argument] doesn't output 0 on; #X text 156 81 bang , so send the 0 here.; -#X obj 26 125 purepd/float_argument $1 0; -#X obj 39 183 trigger bang float; +#X obj 26 185 purepd/float_argument $1 0; +#X obj 39 243 trigger bang float; #X obj 38 76 trigger bang bang; -#X obj 204 125 purepd/float_argument $2 1; +#X obj 204 185 purepd/float_argument $2 1; +#X floatatom 215 208 5 0 0 0 - - -; +#X floatatom 36 208 5 0 0 0 - - -; +#X obj 209 234 print MAX; +#X obj 107 221 print MIN; +#X msg 207 163 bang; +#X obj 48 102 float $1; +#X obj 48 123 select 0; +#X obj 93 144 bang; +#X msg 48 144 0; +#X text 124 110 since Pd inits unused vars to 0 , [float_argument] +uses 0 to mean no argument for $1. But we need 0 , so we have to +set up this extra test.; #X connect 0 0 9 0; #X connect 1 0 13 0; #X connect 8 0 14 0; #X connect 9 0 2 0; #X connect 9 1 3 0; #X connect 12 0 9 0; +#X connect 12 0 17 0; +#X connect 12 0 19 0; #X connect 13 0 9 0; #X connect 13 1 9 1; #X connect 14 0 12 0; +#X connect 14 0 21 0; #X connect 14 1 15 0; #X connect 15 0 9 1; +#X connect 15 0 16 0; +#X connect 15 0 18 0; +#X connect 20 0 15 0; +#X connect 21 0 22 0; +#X connect 22 0 24 0; +#X connect 22 1 23 0; +#X connect 23 0 12 0; +#X connect 24 0 12 0; #X restore 418 263 pd output range; #N canvas 463 201 389 220 track 0; #X obj 168 22 inlet;
Modified: branches/pd-extended/v0-40/externals/mapping/help/autoscale-help.pd =================================================================== --- branches/pd-extended/v0-40/externals/mapping/help/autoscale-help.pd 2008-07-17 08:18:05 UTC (rev 10170) +++ branches/pd-extended/v0-40/externals/mapping/help/autoscale-help.pd 2008-07-17 21:45:38 UTC (rev 10171) @@ -1,75 +1,77 @@ -#N canvas 320 22 451 673 10; -#X floatatom 26 76 5 0 0 0 - - -; -#X floatatom 26 140 0 0 0 0 - - -; -#X obj 2 -10 cnv 15 450 20 empty empty [autoscale] 2 11 1 18 -233017 +#N canvas 83 22 458 658 10; +#X floatatom 26 73 5 0 0 0 - - -; +#X floatatom 26 137 0 0 0 0 - - -; +#X obj 2 -10 cnv 15 450 20 empty empty autoscale 2 11 1 18 -233017 -66577 0; -#X text 18 23 [autoscale] scales a stream of numbers based on an output +#X text 18 20 [autoscale] scales a stream of numbers based on an output range set as arguments , and an input range which is set dynamically. ; -#X floatatom 173 253 5 0 0 1 min - -; -#X floatatom 150 140 0 0 0 0 - - -; -#X floatatom 297 140 0 0 0 0 - - -; -#X obj 213 71 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 +#X floatatom 150 137 0 0 0 0 - - -; +#X floatatom 297 137 0 0 0 0 - - -; +#X obj 213 68 hsl 128 15 0 127 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; -#X floatatom 136 363 5 0 0 0 - - -; -#X obj 161 416 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 +#X floatatom 136 359 5 0 0 0 - - -; +#X obj 161 412 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; -#X msg 186 361 reset; -#X text 13 181 If you use [autoscale] with no arguments , then the +#X msg 186 357 reset; +#X text 13 172 If you use [autoscale] with no arguments , then the output range defaults to 0-1.; -#X msg 239 361 bang; -#X text 14 211 You can also set the output min and max using the 2nd +#X msg 239 357 bang; +#X text 14 202 You can also set the output min and max using the 2nd and 3rd inlets:; -#X floatatom 229 253 5 0 0 1 max - -; -#X obj 295 361 tgl 15 1 empty empty empty 0 -6 0 8 -262144 -1 -1 1 +#X obj 295 357 tgl 15 1 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1; -#X text 14 322 The [reset( message or banging the 4th inlet resets +#X text 14 318 The [reset( message or banging the 4th inlet resets the stored max and min to zero. 0 disables the auto-tracking , 1 re-enables it:; -#X floatatom 81 505 5 0 0 0 - - -; -#X obj 130 630 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 +#X floatatom 81 491 5 0 0 0 - - -; +#X obj 130 616 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; -#X text 16 453 The dump message allow "autoscale" to output the min +#X text 16 439 The dump message allow "autoscale" to output the min and max of the input data. this allow user to save this data in order to load the same callibration with a loadbang :; -#X obj 300 532 tgl 15 1 empty empty empty 0 -6 0 8 -262144 -1 -1 1 +#X obj 300 518 tgl 15 1 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1; -#X obj 215 579 pack float float; -#X msg 148 500 save; -#X msg 215 600 set load $1 $2; -#X msg 150 523 load 1 11; -#X msg 323 531 bang; -#X floatatom 158 306 7 0 0 0 - - -; -#X obj 135 234 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 +#X obj 215 565 pack float float; +#X msg 148 486 save; +#X msg 215 586 set load $1 $2; +#X msg 150 509 load 1 11; +#X msg 323 517 bang; +#X floatatom 158 297 7 0 0 0 - - -; +#X obj 135 225 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; -#X obj 297 110 autoscale -4095 4095; -#X obj 150 110 autoscale -0.01 0.01; -#X obj 158 284 autoscale; -#X obj 158 393 autoscale; -#X obj 26 110 autoscale; -#X obj 127 556 autoscale 0 1 ______________; -#X connect 0 0 32 0; -#X connect 4 0 30 1; -#X connect 7 0 28 0; +#X obj 297 107 autoscale -4095 4095; +#X obj 150 107 autoscale -0.01 0.01; +#X obj 158 275 autoscale; +#X obj 158 389 autoscale; +#X obj 26 107 autoscale; +#X obj 127 542 autoscale 0 1 ______________; +#X obj 231 244 nbx 3 16 -1e+37 1e+37 0 1 empty empty max 40 8 0 10 +-228856 -1 -1 1 256; +#X obj 171 244 nbx 3 16 -1e+37 1e+37 0 1 empty empty min 40 8 0 10 +-228856 -1 -1 0 256; +#X connect 0 0 30 0; +#X connect 6 0 26 0; +#X connect 6 0 27 0; #X connect 7 0 29 0; -#X connect 8 0 31 0; -#X connect 10 0 31 0; -#X connect 12 0 31 3; -#X connect 14 0 30 2; -#X connect 15 0 31 3; -#X connect 17 0 33 0; -#X connect 20 0 33 3; -#X connect 21 0 23 0; -#X connect 22 0 33 0; -#X connect 23 0 24 0; -#X connect 24 0 33 0; -#X connect 25 0 33 3; -#X connect 27 0 30 0; -#X connect 28 0 6 0; -#X connect 29 0 5 0; -#X connect 30 0 26 0; -#X connect 31 0 9 0; -#X connect 32 0 1 0; -#X connect 33 0 18 0; -#X connect 33 1 21 0; -#X connect 33 2 21 1; +#X connect 9 0 29 0; +#X connect 11 0 29 3; +#X connect 13 0 29 3; +#X connect 15 0 31 0; +#X connect 18 0 31 3; +#X connect 19 0 21 0; +#X connect 20 0 31 0; +#X connect 21 0 22 0; +#X connect 22 0 31 0; +#X connect 23 0 31 3; +#X connect 25 0 28 0; +#X connect 26 0 5 0; +#X connect 27 0 4 0; +#X connect 28 0 24 0; +#X connect 29 0 8 0; +#X connect 30 0 1 0; +#X connect 31 0 16 0; +#X connect 31 1 19 0; +#X connect 31 2 19 1; +#X connect 32 0 28 2; +#X connect 33 0 28 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.