Forums > MaxMSP

1+1 = 1?

June 20, 2013 | 3:07 am

Hi,

The attached patch counts space bar presses. However, it takes two presses to make the counter reach 1! I cant figure out what I’ve done wrong. any help please!?!

<code>

– Pasted Max Patch, click to expand. –

</code>


June 20, 2013 | 3:17 am

Counter starts counting from 0 by default. You can change the minimum number using the "setmin" message

<code>

– Pasted Max Patch, click to expand. –

</code>


June 20, 2013 | 3:33 am

Thanks, but still not working. I have put setmin in teh patch and it still takes 2 key presses to make it register 1…..

<code>

– Pasted Max Patch, click to expand. –

</code>


June 20, 2013 | 5:53 am

Hi
not sure why that happens, but whenever I want to initalize a [counter] I always set it to my minimum via the 4th inlet:

<code>

– Pasted Max Patch, click to expand. –

</code>

Brendan


June 20, 2013 | 6:57 am

yeah, "setmin $1" looks broken, at least on 6.1.2

I hardly ever initialize counters – if I want to count from 1 and upwards I typically do [+ 1] after the counter.


June 20, 2013 | 7:13 am

Try: [counter 1 0x7FFFFFFF]


June 20, 2013 | 11:31 am

I tend to use the sync reset for this sort of thing:

<code>

– Pasted Max Patch, click to expand. –

</code>

(and I’m sorry that there are so many quirks in counter. It was my first external, and my first C code)


June 20, 2013 | 12:53 pm

>> I tend to use the sync reset for this sort of thing

Yes, so do I.


June 20, 2013 | 2:36 pm

Wetterberg, it was here prior to 6.12. I got mad with this in one on my patches, trying to figure out where my mistake was…
Chris : any chance you rewrite it ?
None of these three solutions works at first try : it only works once you have reset the counter for the first time. That means you have to launch it then reset it to get the desired behavior…


June 20, 2013 | 3:13 pm

The maintenance of counter has been out of my hands since the 1990s.

I don’t see what the problem with initializing to a desired state with something like loadbang / loadmess is, and doesn’t Christopher’s [counter 1 0x7FFFFFFF] do it without any further initialization?

This sort of initialization is just part of the process, IMO.


June 21, 2013 | 12:41 am

And "reset to number immediately" seems pretty self-explanatory to me.


June 21, 2013 | 1:56 am

Ok, this works for me like this :
<code>

– Pasted Max Patch, click to expand. –

</code>

I wrote the previous post because it happened to me to get mad after trying all the solutions you proposed.


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