Two items in a matrix sends a value, anyone else resets everything?

Rodrigo's icon

So I'm working on a monome-style button layout and am using matrixctrl to simulate the presses (I don't have a monome).

I want to be able to press two buttons and that tell me which two I've pressed (this much is working). Then I want to reset my starting values (0. and 1.) when anything else happens (pressing a single button).

At the moment the logic (using zl filter, len, and reg) spits me out a value when two items are pressed, but I can't figure out how to tell when I'm only doing one press thereafter (without sending a bang on the 'button release' as well).

I thought about using [sel 1] in the mix to filter out 0s when I unclick a matrix dot, but I'm terrible at working with list stuff.

Here is the bit of code in question.

Max Patch
Copy patch and select New From Clipboard in Max.

Luke Hall's icon

If you hook the second outlet of your [select] object (the outlet that triggers if only one button is pressed) to a [t 0 1] and then feed these in to your dials it will reset them. Is this what you want?

Rodrigo's icon

That's what I tried originally but that bangs when a button is unpressed (when I go from 2 buttons to 1 briefly).
So I need to differentiate between going from 2buttons to 1 (when removing presses) and when actually pressing 1.

Rodrigo's icon

To clarify, when I have two buttons pressed, if I lift one finger before the other, it bangs as it's a list of one item.

Luke Hall's icon

Have a look at [bucket] so you can store the previous number of buttons pressed and then some of the logical operators like [==] to figure out if the previous number was greater. Then you can [trigger] the desired values.