Wait for two bangs in either order, one bang out and reset

Darren Blondin's icon

I've been having trouble wrapping my head around this one, and it seems like it would be so simple. I'm waiting for two bangs, they happen close together and sometimes in a different order. But I need to wait for both before sending one, at which point I need to wait for both again. How would I do this?

Darren Blondin's icon

This might work.

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

Pedro Santos's icon

or this:

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

Source Audio's icon

The question is not clear - are this 2 bangs coming from different sources,
and does the bang to send have to report which bang came first or last in, from
which origin it came and so on.
If You just need doubleclick detection, timer as Pedro suggested is perfect.
If You need something else please ask precisely.

Darren Blondin's icon

Thanks Pedro. But it's not filtering I need. Sometimes the delay between the two can be rather long. Although it is hard for me to wrap my head around, this matrix of onebangs seems to be doing the trick.

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

Source Audio's icon
Max Patch
Copy patch and select New From Clipboard in Max.

if it is just so simple, why would You not use buddy ?

Bill 2's icon

I agree with Source Audio, but in the meantime, what about [buddy] ?

Bill 2's icon

Hah, talk about fast replies! :-)

Source Audio's icon

indeed, our 2 messages could have passed buddy AND doubleclick detection

Darren Blondin's icon

Source Audio has it. That's exactly what I need. Thanks. You guys rock.

I'm reading in files off disk and sometimes they take a while to load before I can play them. I could probably have written the rest of the code better but with this in place I don't have to. :)

Source Audio's icon

great that it works for You. buddy can have several inputs, if You need to know when
more than 2 objects finished reading files, just have a look in the help file.

Roman Thilenius's icon

[t 1] [t 1]
[zl group 2]
[t b]

...or use a counter.