Counter palindrome mode
In mode 2, counter counts up, then down. Is there a way to reverse this so that it counts down and then up?
Thanks
Here's two ways to do it:
Thanks. Both methods are far more elegant then the hack I've been working on. The difficulty with both is that I want to be able to change the counter value using the set message (eg set 5) and for it to proceed counting down and then up.
ah, that proved to be even more elegant than the other solutions:
Everytime you set the maximum, it also sets the current value, so it automatically goes down first (because there is no more further 'up' to go).
Apologies and thanks for your patience- I'm not explaining this very well. I need the count range to be preserved. I think I've got my version working as intended, but it's a cumbersome piece of code!
Ah, now I get it. Hope this does the trick:
(you need to "reset" the updown counting, so that it always goes down, regardless of what direction it was going before you set the number)
a "good" palindrome is difficult.
you can either use plain math (% 16), (!- 16), or you can use 2 independent counters.
for me the latter seems for be simpler when you want to switch counting modes
during play, and also for a "reset" function.
roll your own palindrome:
Panaiotis's autocount object has 'updown' and 'downup' counting modes, as well as various others. You can find it here: http://www.unm.edu/~panaioti/Max/ObjMenu.htm
Below is an 'autocountoid' abstraction that I made when autocount was not UB, and which also has an 'uppdownn' mode, ie. repeating the max and min before changing direction, which is useful for arpeggiators etc.
Iirc, the arguments are count mode, initial value, min, max, step and ms between ticks,
cheers
Roger