Forums > Max For Live

live.toggle set behaviour – i just don't get it.

June 13, 2012 | 4:07 pm

I’m trying to use a button on my controller to simultaneously provide feedback and act as a button (great!). The button on the controller sends a 1 on down and a 0 on up. So far so good, live.button directly interacts and reflects that changes.
Now to provide feedback i set the button to another value than the one received from the controller. Here’s a simple patch to demonstrate:

– Pasted Max Patch, click to expand. –

The delay in there is because of the fact that my controllers button sends a zero on up, and live.button reacts to that. So i tried to wait a bit (until live.button has received the zero from the controller) and then set live.button to whatever value it should have.

No luck, this just doesn’t work. Why not? Any solution to this?


June 13, 2012 | 6:53 pm

I wondered about this for a bit myself, but it seems the output of the (set $1) message does not appear as a bang to the delay object (and the message "set: bad number" is posted to the max window). I’m not sure as to why the [select] is in the patch – among other things – so this may still need tweaking to work properly in your situation

– Pasted Max Patch, click to expand. –

`


June 14, 2012 | 2:02 pm

Hm, you where right about the bang. The patch is now working, thank you very much.

By the way: the select is there to differentiate between the down(1) and up(0) of the hardware controllers button.

I just realized that i could easily use the patch i did show to transform a hardware gate button to a toggle. Like this:

– Pasted Max Patch, click to expand. –

The only thing not working well is when i mouse-click the button, instead of pressing the hardware controllers button. That way the zero on button-up is not being sent, and you have to press the button on the hardware controller twice… No solution to this yet.


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