[Gridflow-cvs] [svn] commit: r5996 - in /trunk: doc/flow_classes/#tabread-help.pd src/classes3.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Sun Aug 8 21:59:13 EDT 2010


Author: pboivin
Date: Sun Aug  8 21:59:11 2010
New Revision: 5996

Log:
don't pd_findbyclass() and garray_getfloatwords() for each value ...

Modified:
    trunk/doc/flow_classes/#tabread-help.pd
    trunk/src/classes3.cxx

Modified: trunk/doc/flow_classes/#tabread-help.pd
==============================================================================
--- trunk/doc/flow_classes/#tabread-help.pd (original)
+++ trunk/doc/flow_classes/#tabread-help.pd Sun Aug  8 21:59:11 2010
@@ -2,15 +2,12 @@
 #X obj 0 0 doc_h;
 #X obj 3 583 doc_also;
 #X obj 0 605 doc_f;
-#X obj 76 83 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
+#X obj 59 83 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
 -1;
-#X obj 86 223 print;
-#X obj 86 203 #to_l;
-#X obj 76 101 #for 0 15 1;
-#X obj 439 116 table \$0-matable 10;
+#X obj 69 223 print;
+#X obj 69 203 #to_l;
 #X text 26 36 Takes a grid containing indexes and outputs a grid containing
 the values read from a table \, for each index.;
-#X obj 86 168 #tabread \$0-matable;
 #X obj 3 270 doc_c 1;
 #X obj 14 300 doc_cc 0;
 #X obj 97 300 doc_m c0 symbol;
@@ -25,7 +22,7 @@
 the table.;
 #X text 232 397 If an index is negative \, it will return the value
 of the first element.;
-#X msg 96 121 3 3 # 0 0 2 4 6 6 1 2 3;
+#X msg 79 121 3 3 # 0 0 2 4 6 6 1 2 3;
 #X text 232 432 If an index is greater than the last element of the
 table \, it will return the value of the last element.;
 #X text 232 551 Output grid containing all values read from the table.
@@ -34,37 +31,33 @@
 #X obj 97 467 doc_m i0 set;
 #X text 232 467 \$1=table;
 #X text 232 489 Dynamically set the table to read from.;
-#X obj 439 136 table \$0-tatable 10;
-#X obj 261 121 symbol \$0-tatable;
-#X obj 261 101 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
--1 -1;
-#X msg 261 141 set \$1;
-#N canvas 6 63 450 300 init_tables 0;
-#X obj 55 47 loadbang;
-#X msg 75 77 0 3 72 55 64 87 2 11 5 6 22;
-#X obj 75 97 s \$0-matable;
-#X msg 55 127 0 99 98 97 96 95 94 93 92 91 90;
-#X obj 55 147 s \$0-tatable;
-#X connect 0 0 1 0;
-#X connect 0 0 3 0;
-#X connect 1 0 2 0;
-#X connect 3 0 4 0;
-#X restore 439 96 pd init_tables;
-#X obj 154 204 display;
-#X connect 1 1 16 0;
-#X connect 3 0 6 0;
+#X obj 137 204 display;
+#X msg 244 131 set tatable;
+#X obj 494 162 table tatable 10;
+#X obj 494 142 table matable 10;
+#X obj 69 168 #tabread matable;
+#X msg 402 108 0 99 98 97 96 95 94 93 92 91 90;
+#X msg 422 68 0 2 4 6 8 10 12 14 16 18 20;
+#X obj 422 88 s matable;
+#X obj 402 128 s tatable;
+#X obj 402 48 loadbang;
+#X obj 59 101 #for 0 10 1;
+#X connect 1 1 13 0;
+#X connect 3 0 36 0;
 #X connect 5 0 4 0;
-#X connect 6 0 9 0;
-#X connect 9 0 5 0;
-#X connect 9 0 34 0;
-#X connect 12 1 19 0;
-#X connect 17 1 20 0;
-#X connect 17 1 21 0;
-#X connect 17 1 23 0;
-#X connect 18 1 24 0;
-#X connect 22 0 9 0;
-#X connect 26 1 27 0;
-#X connect 26 1 28 0;
-#X connect 30 0 32 0;
-#X connect 31 0 30 0;
-#X connect 32 0 9 0;
+#X connect 9 1 16 0;
+#X connect 14 1 17 0;
+#X connect 14 1 18 0;
+#X connect 14 1 20 0;
+#X connect 15 1 21 0;
+#X connect 19 0 30 0;
+#X connect 23 1 24 0;
+#X connect 23 1 25 0;
+#X connect 27 0 30 0;
+#X connect 30 0 5 0;
+#X connect 30 0 26 0;
+#X connect 31 0 34 0;
+#X connect 32 0 33 0;
+#X connect 35 0 32 0;
+#X connect 35 0 31 0;
+#X connect 36 0 30 0;

Modified: trunk/src/classes3.cxx
==============================================================================
--- trunk/src/classes3.cxx (original)
+++ trunk/src/classes3.cxx Sun Aug  8 21:59:11 2010
@@ -1443,12 +1443,12 @@
 	t_word *vec;
 	float32 tada[n];
 	
-	for (int i=0; i<n; i++) {
-		if (!(a = (t_garray *)pd_findbyclass(t, garray_class)))
-			RAISE("%s: no such array", t->s_name);
-		else if (!garray_getfloatwords(a, &npoints, &vec))
-			RAISE("%s: bad template for tabread", t->s_name);
-		else {
+	if (!(a = (t_garray *)pd_findbyclass(t, garray_class)))
+		RAISE("%s: no such array", t->s_name);
+	else if (!garray_getfloatwords(a, &npoints, &vec))
+		RAISE("%s: bad template for tabread", t->s_name);
+	else {
+		for (int i=0; i<n; i++) {
 			int index = data[i];
 			if (index < 0) index = 0;
 			else if (index >= npoints) index = npoints - 1;



More information about the Gridflow-cvs mailing list