#N canvas 482 46 568 700 10;
#N canvas 584 143 498 356 All_Messages 0;
#X text 75 52 dec -;
#X text 69 69 down -;
#X text 39 6 carrybang -;
#X text 45 23 carryint -;
#X text 21 85 flags <list> -;
#X text 75 130 inc -;
#X text 27 147 jam <float> -;
#X text 67 176 next -;
#X text 62 258 state -;
#X text 80 274 up -;
#X text 56 291 updown -;
#X text 25 191 max <float> -;
#X text 114 275 sets counter direction to upwards, f 63;
#X text 8 242 setmin <float> -;
#X text 26 207 min <float> -;
#X text 21 114 goto <float> -;
#X text 26 225 set <float> -;
#X text 114 114 same as 'set' message, f 63;
#X text 114 291 sets direction to shift between up/down when reaching limits, f 63;
#X text 114 69 sets direction to downwards, f 63;
#X text 114 85 1st float sets 'carryflag': 0 (carryint) \, 1 (carrybang). 2nd sets 'compatmode' mode: 0 (current) \, 1 (ancient), f 56;
#X text 114 225 sets counter's next value (considering direction) - no output, f 63;
#X text 114 208 sets minimum value and outputs it, f 63;
#X text 114 242 sets minimum value (doesn't output it), f 63;
#X text 114 192 sets maximum value (doesn't output it), f 63;
#X text 114 317 sets @compatmode attribute: (0 = current \, 1 = ancient), f 63;
#X text 8 317 compatmode <f> -;
#X text 14 334 carryflag <f> -;
#X text 114 334 sets @carryflag attribute: (0 = carryint \, 1 = carrybang), f 63;
#X text 0 304 ----------------------------------------------------------------------------------, f 82;
#X text 114 6 sets to "carrybang" mode: sends bangs at count rounds, f 63;
#X text 114 22 sets to "carryint" mode (default): sends "1" at the end of a count round \, "0" at the start of the next round, f 63;
#X text 114 52 decrements counter by 1 (regardless of the direction), f 63;
#X text 114 130 increments counter by 1 (regardless of the direction), f 63;
#X text 114 176 outputs next value (same as bang), f 63;
#X text 114 147 sets counter to that value and outputs it - values outside the range are ignored, f 63;
#X text 114 258 (in any inlet) prints current settings state on the Pd window, f 63;
#X restore 382 276 pd All_Messages;
#X obj 2 245 cnv 3 550 3 empty empty inlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 2 446 cnv 3 550 3 empty empty outlets 8 12 0 13 #dcdcdc #000000 0;
#X obj 2 584 cnv 3 550 3 empty empty arguments 8 12 0 13 #dcdcdc #000000 0;
#X obj 89 252 cnv 17 3 39 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 89 299 cnv 17 3 26 empty empty 1 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 89 333 cnv 17 3 36 empty empty 2 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 89 376 cnv 17 3 36 empty empty 3 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 89 417 cnv 17 3 24 empty empty 4 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 89 452 cnv 17 3 17 empty empty 0 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 89 475 cnv 17 3 36 empty empty 1 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 89 517 cnv 17 3 35 empty empty 2 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 89 559 cnv 17 3 17 empty empty 3 5 9 0 16 #dcdcdc #9c9c9c 0;
#X obj 2 676 cnv 15 552 21 empty empty empty 20 12 0 14 #e0e0e0 #202020 0;
#X text 123 251 bang;
#X text 157 299 -;
#X text 123 298 bang;
#X text 157 313 -;
#X text 117 312 float;
#X text 157 331 -;
#X text 123 331 bang;
#X text 157 345 -;
#X text 117 345 float;
#X text 157 373 -;
#X text 123 373 bang;
#X text 157 387 -;
#X text 117 387 float;
#X text 157 415 -;
#X text 123 415 bang;
#X text 157 430 -;
#X text 117 430 float;
#X text 157 453 -;
#X text 117 453 float;
#X text 157 473 -;
#X text 123 473 bang;
#X text 157 487 -;
#X text 117 488 float;
#X text 157 516 -;
#X text 123 516 bang;
#X text 157 532 -;
#X text 117 532 float;
#X text 157 562 -;
#X text 117 562 float;
#X obj 204 162 nbx 2 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X text 109 590 1) list -;
#X obj 204 106 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 2 635 cnv 3 550 3 empty empty attributes 8 12 0 13 #dcdcdc #000000 0;
#X text 157 278 - for all available messages \, check:, f 62;
#X text 157 264 - same as bang, f 60;
#X text 117 265 float;
#X text 238 161 <= counter value;
#X text 172 312 sets direction \, 0: up \, 1: down \, 2: updown (alternating), f 60;
#X text 172 515 when max is reached (if 'carrybang' is set & counting up), f 61;
#X text 172 472 when min is reached (if carrybang is set & counting down), f 61;
#X text 157 251 - goes to the next value and outputs it;
#X text 172 386 sets counter value and outputs it - if outside the range \, it resets min/max according to compatmode (see example above);
#X text 139 639 @carryflag: 0 for carryint (default) / 1 for carrybang, f 57;
#X text 98 654 @compatmode: 0 for current (default) / 1 for ancient (see example above), f 72;
#N canvas 444 139 768 348 compatmode 0;
#X obj 84 314 nbx 4 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 36 208 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 184 236 nbx 4 14 -5 5 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 234 260 nbx 4 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X msg 84 211 compatmode \$1;
#X obj 84 185 tgl 17 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000 0 1;
#X text 106 185 (0: current \, 1: ancient);
#X obj 187 212 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 237 236 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X text 221 211 set value;
#X text 245 235 set & output value;
#X obj 480 108 tgl 15 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 480 129 cyclone/pak;
#X obj 543 108 tgl 15 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 480 259 nbx 4 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 537 249 route bang;
#X obj 537 279 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 594 279 tgl 18 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 631 248 route bang;
#X obj 631 278 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 688 279 tgl 18 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 439 154 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 568 152 hsl 128 15 -5 0 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 565 174 nbx 2 14 -5 5 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 611 173 hsl 128 15 -10 10 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 608 193 nbx 2 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X text 410 108 carrymode;
#X text 560 106 compatmode;
#X msg 480 154 flags \$1 \$2;
#X obj 480 213 cyclone/counter 2 1 5, f 29;
#X text 20 15 The 'compatmode' message or attribute sets to "current" or "ancient" mode. In both modes \, a float input into the 3rd inlet sets the counter value but does not output it and a float input into the 4th inlet sets the counter value and outputs it. But its behaviour is diffetent.;
#X text 18 90 In the default current mode ('compatmode 0') - a number outside the range sets the minimum or maximum value just once \, reverting to the original range after a round. But in 'compatmode 1' ('ancient mode' \, for max 3.x compatibility) \, it always sets the minimum value.;
#X text 402 32 The 'flags' message sets both attributes at once \, the 1st argument is for carrymode (0: carryint \, 1: carrybang) and the 2nd is for compatmode (0: current \, 1: ancient).;
#X obj 84 283 cyclone/counter 5 10 @compatmode 0;
#X connect 1 0 33 0;
#X connect 2 0 33 2;
#X connect 3 0 33 3;
#X connect 4 0 33 0;
#X connect 5 0 4 0;
#X connect 7 0 2 0;
#X connect 8 0 3 0;
#X connect 11 0 12 0;
#X connect 12 0 28 0;
#X connect 13 0 12 1;
#X connect 15 0 16 0;
#X connect 15 1 17 0;
#X connect 18 0 19 0;
#X connect 18 1 20 0;
#X connect 21 0 29 0;
#X connect 22 0 23 0;
#X connect 23 0 29 2;
#X connect 24 0 25 0;
#X connect 25 0 29 3;
#X connect 28 0 29 0;
#X connect 29 0 14 0;
#X connect 29 1 15 0;
#X connect 29 2 18 0;
#X connect 33 0 0 0;
#X restore 465 138 pd compatmode;
#N canvas 539 59 748 402 carrymode 0;
#X obj 171 250 nbx 2 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 171 161 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 212 249 tgl 18 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 253 249 tgl 18 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 294 251 nbx 2 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X floatatom 212 275 2 0 0 0 - - - 0;
#X floatatom 253 275 2 0 0 0 - - - 0;
#X obj 201 144 vradio 15 1 0 3 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0;
#X text 219 144 0: up;
#X text 219 159 1: down;
#X text 219 174 2: updown;
#X floatatom 201 197 2 0 0 0 - - - 0;
#X text 273 274 maximum;
#X text 158 274 minimum;
#X obj 554 168 nbx 2 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 554 83 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 677 169 nbx 2 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 584 67 vradio 15 1 0 3 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0;
#X text 602 67 0: up;
#X text 602 82 1: down;
#X text 602 97 2: updown;
#X floatatom 584 117 2 0 0 0 - - - 0;
#X obj 595 165 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 636 165 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X text 407 13 The 'carrybang'mode sends just one bang when reaching maximum (3rd outlet) and minimum (2nd outlet);
#X msg 479 255 carryflag \$1;
#X obj 479 233 tgl 15 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000 0 1;
#X msg 463 203 carrybang;
#X obj 452 286 cyclone/counter 2 1 5 @carryflag 1, f 43;
#X obj 452 323 nbx 2 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 537 322 route bang;
#X obj 537 351 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 594 351 tgl 19 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 622 321 route bang;
#X obj 622 351 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 679 351 tgl 19 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 415 205 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X text 561 249 (0: carryint \, 1: carrybang), f 13;
#X msg 476 93 carrybang;
#X obj 476 67 loadbang;
#X msg 452 175 carryint;
#X text 17 12 The 'carrymode' sets how [counter] responds at the end of a round (when it reaches the upper limit when counting up or the lower limit when counting down).;
#X text 17 58 The default mode is 'carryint'. When counting up \, it outputs '1' when reaching the maximum value out the 3rd outlet \, and outputs '0' after leaving the maximum value. And when counting down \, it outputs '1' when reaching the minimum value out the 2nd outlet and outputs '0' after leaving it.;
#X text 22 317 You can set the carrymode with the messages 'carryint' and 'carrybang' \, but also with the @carryflag attribute or message - 'carryflag 0' sets to 'carryint' (the default) and 'carryflag 1' to 'carrybang';
#X text 53 204 carryint mode:;
#X text 62 221 (default);
#X obj 554 137 cyclone/counter 2 1 5;
#X obj 171 219 cyclone/counter 2 1 5;
#X obj 253 296 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000;
#X obj 212 297 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000;
#X connect 1 0 47 0;
#X connect 2 0 5 0;
#X connect 3 0 6 0;
#X connect 5 0 49 0;
#X connect 6 0 48 0;
#X connect 7 0 11 0;
#X connect 11 0 47 1;
#X connect 15 0 46 0;
#X connect 17 0 21 0;
#X connect 21 0 46 1;
#X connect 25 0 28 0;
#X connect 26 0 25 0;
#X connect 27 0 28 0;
#X connect 28 0 29 0;
#X connect 28 1 30 0;
#X connect 28 2 33 0;
#X connect 30 0 31 0;
#X connect 30 1 32 0;
#X connect 33 0 34 0;
#X connect 33 1 35 0;
#X connect 36 0 28 0;
#X connect 38 0 46 0;
#X connect 39 0 38 0;
#X connect 40 0 28 0;
#X connect 46 0 14 0;
#X connect 46 1 22 0;
#X connect 46 2 23 0;
#X connect 46 3 16 0;
#X connect 47 0 0 0;
#X connect 47 1 2 0;
#X connect 47 2 3 0;
#X connect 47 3 4 0;
#X restore 471 117 pd carrymode;
#X text 111 134 counting up =>;
#X text 227 106 <= next value;
#X text 172 562 counts how many times the counter reached the maximum, f 61;
#N canvas 459 159 824 356 more 0;
#X obj 142 253 hsl 128 15 0 100 0 0 empty empty empty -2 -8 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 139 318 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 139 284 cyclone/counter;
#X msg 557 67 state;
#X obj 126 151 hradio 15 1 0 8 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0;
#X obj 126 173 nbx 2 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 126 64 tgl 15 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000 0 1;
#X text 401 32 The 'state'message reports the current settings of [counter] on the Pd window.;
#X obj 605 67 bng 15 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 530 67 bng 15 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 126 88 metro 150;
#X obj 655 126 tgl 15 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 606 126 tgl 15 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000 0 1;
#X obj 557 100 cyclone/counter 0 1 5, f 25;
#X msg 704 64 state;
#X obj 126 116 cyclone/counter 7;
#X text 28 202 A float in the leftmost inlet is the same as a bang \, so you can bcount how many floats have been received.;
#X text 19 17 An example of usage: - Setup a [metro] to turn [counter] into a step sequencer \, such as the 8-step example below.;
#X obj 557 127 nbx 4 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 704 127 nbx 4 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X text 412 159 x_mincount: - the minimum value \; x_maxcount: - the maximum value \; x_direction: - the direction mode: 0/1/2 (up/down/updown) \; x_curcount: - the current count value \; x_curdir: - the current direction: 0/1 (up/down) \; x_carrycount: - how many times it reached the maximum \; x_carry: - carryint value (0/1) when counting up \; x_under: - carryint value (0/1) when counting down \; x_carrymode: - carrymode: 0/1 (carryint/carrybang) \; x_compat: - compatmode: 0/1 (current/ancient) \; x_startup: - '1' if still in the startup value \, '0' if not \; x_inletnum: - inlet number that the state message came in \;, f 60;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X connect 3 0 13 0;
#X connect 4 0 5 0;
#X connect 6 0 10 0;
#X connect 8 0 13 1;
#X connect 9 0 13 0;
#X connect 10 0 15 0;
#X connect 13 0 18 0;
#X connect 13 1 12 0;
#X connect 13 2 11 0;
#X connect 13 3 19 0;
#X connect 14 0 13 4;
#X connect 15 0 4 0;
#X restore 501 159 pd more;
#X text 172 344 sets counter value with no output - if outside the range \, it resets min/max according to compatmode (see example above);
#X obj 204 134 cyclone/counter 10 15;
#X text 337 134 (from 10 to 15);
#X text 99 278 messages;
#N canvas 500 23 812 529 basic_1 0;
#X obj 203 180 nbx 2 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 203 116 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 203 149 cyclone/counter;
#X obj 108 353 nbx 2 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 108 289 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 108 322 cyclone/counter 5;
#X obj 106 498 nbx 2 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 106 434 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 248 353 nbx 2 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 248 289 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 586 303 vradio 15 1 0 3 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0;
#X text 604 303 0: up;
#X text 604 318 1: down;
#X text 604 333 2: updown;
#X obj 541 416 nbx 2 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 541 320 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X floatatom 586 357 2 0 0 0 - - - 0;
#X obj 670 416 nbx 2 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 541 440 bng 15 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 670 440 bng 15 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 573 263 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X msg 437 283 up;
#X msg 470 284 down;
#X msg 511 283 updown;
#X text 702 415 <= how many;
#X text 714 428 times max;
#X text 702 439 was reached;
#X obj 541 385 cyclone/counter 1 0 5, f 22;
#X text 683 384 <= from 5 to 0;
#X text 689 371 counting down;
#X msg 234 117 next;
#X msg 143 290 next;
#X msg 283 290 next;
#X msg 137 436 next;
#X text 600 415 carrycount:;
#X text 601 264 <= switch direction;
#X obj 265 498 nbx 2 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 265 434 bng 19 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X msg 297 436 next;
#X obj 106 467 cyclone/counter 1 5 1;
#X obj 265 466 cyclone/counter 2 1 5;
#X text 270 116 next value;
#X text 487 411 counter;
#X text 499 423 value;
#X text 24 21 If there are no arguments \, the direction is up \, the minimum is 0 \, and the maximum is 6.777.216 (2^24) \, the largest integer possible in Pd (in Max is 2^31 - 1).;
#X text 25 66 A bang or a 'next' message makes counter go to the next value. Note that it starts from the minimum (which is 0 in the example below).;
#X text 33 210 Only one argument sets the maximum value \, so it counts from 0 to that value. Two arguments set the minimum and maximum value (in any order: the smaller of the 2 is always the minimum \, and the greater is the maximum).;
#X obj 248 322 cyclone/counter -2 2;
#X text 35 380 Given three arguments \, the 1st sets the direction (0: up \, 1: down \, 2: updown) and 2nd and 3rd the min/max (also in any order).;
#X text 426 45 If the direction is up and you reach the maximum \, it restarts from the minimum. The 'carrycount' output (rightmost outlet) counts how many times the maximum was reached (but it doesn't count if the direction is down)., f 61;
#X text 426 102 If the direction is down and you reach the minimum \, it restarts from the maximum value. When in "updown" mode \, at the end of each count round (reaching maximum or minimum) it swiches the direction., f 61;
#X text 426 159 A bang in the 2nd inlet switches the direction from up to down or vice versa (it switches from mode 0 to 1 or from 1 to 0 \, but only changes the direction in mode 2)., f 61;
#X text 425 209 You can also set the direction with the messages "up" \, "down" and "updown" or a float input in the 2nd inlet \, see below., f 61;
#X connect 1 0 2 0;
#X connect 2 0 0 0;
#X connect 4 0 5 0;
#X connect 5 0 3 0;
#X connect 7 0 39 0;
#X connect 9 0 47 0;
#X connect 10 0 16 0;
#X connect 14 0 18 0;
#X connect 15 0 27 0;
#X connect 16 0 27 1;
#X connect 17 0 19 0;
#X connect 20 0 27 1;
#X connect 21 0 27 0;
#X connect 22 0 27 0;
#X connect 23 0 27 0;
#X connect 27 0 14 0;
#X connect 27 3 17 0;
#X connect 30 0 2 0;
#X connect 31 0 5 0;
#X connect 32 0 47 0;
#X connect 33 0 39 0;
#X connect 37 0 40 0;
#X connect 38 0 40 0;
#X connect 39 0 6 0;
#X connect 40 0 36 0;
#X connect 47 0 8 0;
#X restore 483 75 pd basic_1;
#N canvas 513 89 814 515 basic_2 0;
#X msg 115 332 set \$1;
#X obj 115 366 counter 10;
#X obj 174 335 bng 15 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 115 392 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 92 112 bng 15 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 176 180 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X msg 120 110 jam \$1;
#X msg 176 112 inc;
#X msg 210 112 dec;
#X obj 176 154 counter 1 10;
#X obj 281 334 bng 15 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 219 391 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X msg 219 331 goto \$1;
#X obj 450 208 bng 18 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 533 306 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X msg 486 188 max \$1;
#X msg 533 188 min \$1;
#X msg 582 188 setmin \$1;
#X obj 533 280 counter 0 1 10, f 16;
#X obj 652 282 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X text 692 280 <= sets max;
#X obj 579 225 bng 15 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 602 242 bng 15 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 626 259 bng 15 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X text 645 257 <= goes to max;
#X text 620 240 <= goes to min;
#X text 596 224 <= sets next value to min;
#X obj 533 327 bng 15 250 50 0 empty empty empty 17 7 0 10 #dcdcdc #000000 #000000;
#X obj 120 86 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X text 183 85 <= sets and outputs;
#X obj 115 306 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 219 307 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 486 167 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 533 167 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X obj 582 167 nbx 3 14 -1e+37 1e+37 0 0 empty empty empty 0 -8 0 10 #dcdcdc #000000 #000000 0 256;
#X text 490 147 max;
#X text 538 148 min;
#X text 587 149 min;
#X text 621 168 (only sets \, no output);
#X text 24 14 The jam message sets the counter value and outputs it. Values outside the range are ignored. The 'inc' & 'dec' messages are used to count up or down from the last output regardless of the direction.;
#X text 14 213 The set message sets the next value (values outside the range are also ignored) without outputting it \, so it needs a 'next' or bang message afterwards. As the direction is considered \, don't change the direction before sending the next message. The 'goto' message is the same as 'set'.;
#X text 282 306 <= same as set;
#X text 405 17 The 'min' message sets a minimum value and otputs it. The 'setmin' message only sets it (no output). The 'max' message sets a new maximum value but doesn't output it (it's the same as a float input in the 5th inlet).;
#X text 409 155 (only sets \, no output), f 11;
#X text 644 300 (same as 'max' message);
#X text 405 79 A bang in the 3rd inlet sets the next value as the minimum. A bang in the 4th inlet sets to the minimum and outputs it. A bang in the 5th inlet sets to the maximum and outputs it.;
#X text 424 361 Careful \, you shouldn't set the minimum greater than the maximum or the maximum lesser than the minimum! If so \, [counter] gets stuck \, but you can set the minimum/maximum back to a proper value., f 63;
#X text 35 307 only sets => (no output), f 12;
#X obj 219 365 counter 10;
#X text 214 441 IMPORTANT: All numbers that set the counter's value or range are integers \, so all floats are converted to integers by disconsidering (truncating) the decimal part.;
#X connect 0 0 1 0;
#X connect 1 0 3 0;
#X connect 2 0 1 0;
#X connect 4 0 9 0;
#X connect 6 0 9 0;
#X connect 7 0 9 0;
#X connect 8 0 9 0;
#X connect 9 0 5 0;
#X connect 10 0 48 0;
#X connect 12 0 48 0;
#X connect 13 0 18 0;
#X connect 14 0 27 0;
#X connect 15 0 18 0;
#X connect 16 0 18 0;
#X connect 17 0 18 0;
#X connect 18 0 14 0;
#X connect 19 0 18 4;
#X connect 21 0 18 2;
#X connect 22 0 18 3;
#X connect 23 0 18 4;
#X connect 28 0 6 0;
#X connect 30 0 0 0;
#X connect 31 0 12 0;
#X connect 32 0 15 0;
#X connect 33 0 16 0;
#X connect 34 0 17 0;
#X connect 48 0 11 0;
#X restore 483 96 pd basic_2;
#X text 174 589 1 float: max / 2 floats: min & max / 3 floats: direction (0: up / 1: down / 2: updown) \, min & max - default values: direction = 0 (up) \, min = 0 \, max = 2^24.;
#X text 172 298 switches up/down direction, f 60;
#X text 65 79 [counter] counts up and/or down by '1' in a given range.;
#X text 172 329 sets counter to minimum value (no output), f 60;
#X text 172 372 sets counter to minimum value and outputs it, f 60;
#X text 172 414 sets counter to maximum value and outputs it, f 60;
#X text 172 429 sets the maximum value (no output), f 60;
#X text 172 452 the current value of the counter, f 61;
#X text 172 532 1 when min is reached \, 0 when next round starts (if carryint is set and counting down), f 61;
#X text 172 487 1 when max is reached \, 0 when next round starts (and 'carryint' is set and counting up), f 61;
#X obj 3 3 ./header counter;
#X text 22 57 Counts over a range;
#X text 65 203 see also:;
#X obj 381 214 open-else;
#X text 134 199 Plugdata users or those with ELSE can also use [else/count] as an alternative, f 39;
#X text 418 191 <-- click;
#X msg 381 192 count;
#X connect 45 0 65 0;
#X connect 65 0 43 0;
#X connect 86 0 83 0;
