Counting the Bang(s)
Cheers, I'm new to the world of Max, so I was wondering if anyone could tell me if what I have in mind is actually possible.
I'm restricted to a one-button design to which I have to apply different sounds and meanings. I would like to be able to activate those different sounds depending on the number of times I press the single button (bang). For example: if I press it once it does something, if I press it again it stops what is doing (like with ADSR => press once and ADS goes, press again and the release kicks in), if I press it twice (fast) it does something else (like starting a chronometer), if I press it again it stops it.
In other words, I'd like to be able to differentiate different functions with a single button depending on how many times it is pressed. Would it be possible?
Thanks in advance,
Ferdinando
accum, timer, cpuclock, del...
Doubleug thanks so much for your inputs! It is possible that I'll integrate the right-most solution, it is not exactly what I had in mind, but it would work! Actually as now I've managed to create what I wanted, the only problem is that one every two bangs actually hit every bang available... As you can see in my patch if you press the main bang twice quickly enough, it opens the right gate, however one every two bangs actually hit every gate because of the reiteration on the toggle. Is there a way for not having the toggle send out any message (not even the "off" position)?
Not totally sure what you're asking, but onebang might help.
In addition to the objects mentioned above you should try to use counter, an object that counts how many bangs you have sent to it. If you use that in conjunction with the timer object, I believe you can create a device that can do different stuff depending on how many times a button is pressed during a limited time frame!
I spent some time trying to do this. I just saw that Doubleug did this a lot more elegantly than me, but this solution should be working too!
might want to use mousestate too because that's closer to a phys button in that you can measure how long it's held?
spray, funnel, decode might also be useful too.
https://en.wikipedia.org/wiki/Dichotomic_search