Forums > MaxMSP

building a data routing selector

November 2, 2008 | 2:49 pm

whilst building another (wii remote-controlled) live looping patch for max/msp i have a question regarding the best construction for a data routing selector.

my selector subpatch (see below) routes data to looper 1, 2, or 3, or 4 for all loopers at once.
now when i use the wii up/down buttons to switch the numbers i want to have the selection jump to 1 when reaching a higher number than 4, or jump to 4 when reaching a higher number than 1.

how could this be done best?

my example patch below (4.6) doesn’t do it, but at least it selects already:

max v2;
#N vpatcher 98 157 698 557;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 230 60 240 196617 optional ind/dec value;
#P comment 147 60 48 196617 data -;
#P newex 25 169 60 196617 loadmess 1;
#P window setfont "Sans Serif" 20.;
#P number 115 250 35 20 0 0 32 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P newex 115 224 44 196617 clip 0 4;
#P newex 115 202 27 196617 +;
#P newex 159 151 31 196617 * -1;
#P message 159 124 14 196617 1;
#P message 82 124 14 196617 1;
#N comlet result;
#P outlet 115 314 15 0;
#N comlet data set external;
#P inlet 241 83 15 0;
#N comlet data -;
#P inlet 159 83 15 0;
#N comlet data +;
#P inlet 81 84 15 0;
#P comment 74 60 48 196617 data +;
#P comment 106 341 100 196617 result;
#P connect 12 0 6 0;
#P connect 4 0 6 0;
#P connect 2 0 6 0;
#P connect 12 0 9 0;
#P connect 8 0 9 0;
#P connect 6 0 9 0;
#P connect 9 0 10 0;
#P connect 10 0 11 0;
#P connect 11 0 5 0;
#P connect 10 0 9 1;
#P connect 12 0 7 0;
#P connect 4 0 7 0;
#P connect 3 0 7 0;
#P connect 7 0 8 0;
#P pop;

for the one inclined: thank you very much in advance!

jrp


November 2, 2008 | 3:58 pm

I think this does what you want:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 216 182 56 9109513 loadmess 1;
#P message 343 156 16 9109513 -1;
#P message 312 156 14 9109513 1;
#P newex 317 230 27 9109513 +;
#P newex 317 257 109 9109513 if $i1 > 4 then 1 else $i1;
#P newex 317 286 109 9109513 if $i1 < 1 then 4 else $i1;
#P number 317 325 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 83 325 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#N counter 1 4;
#X flags 0 0;
#P newobj 83 236 78 9109513 counter 1 4;
#P newex 136 146 27 9109513 t b 1;
#P newex 83 147 27 9109513 t b 0;
#P comment 248 44 15 9109513 -;
#P comment 192 46 17 9109513 +;
#P button 247 62 15 0;
#P button 194 62 15 0;
#P window setfont "Sans Serif" 12.;
#P comment 226 244 21 9109516 or;
#P connect 15 0 7 3;
#P connect 15 0 12 0;
#P connect 10 0 9 0;
#P fasten 10 0 12 1 322 312 436 312 436 220 339 220;
#P connect 5 0 7 0;
#P connect 6 0 7 0;
#P connect 5 1 7 1;
#P connect 6 1 7 1;
#P connect 7 0 8 0;
#P connect 11 0 10 0;
#P connect 12 0 11 0;
#P connect 13 0 12 0;
#P connect 14 0 12 0;
#P connect 1 0 13 0;
#P connect 1 0 5 0;
#P connect 2 0 14 0;
#P connect 2 0 6 0;
#P window clipboard copycount 16;

Regards
jan.


November 2, 2008 | 4:13 pm

(my 1st name’s jan, too)

thanx you very much! works! (i decided for the left variant as it instantiates correctly here to the loadmess you put in there.)

thanx again!

jrp


Viewing 3 posts - 1 through 3 (of 3 total)