Forums > MaxMSP

bang when patch is unlocked


Mar 15 2011 | 4:41 am

Anyone know how to receive a bang when the patch it unlocked? I can’t seem to find the object/workaround.

Thanks.

Mar 15 2011 | 6:00 am

This is something that you can get at via javascript. this.patcher.locked will return a 0 (unlocked) or 1 (locked).

-Ben

Mar 17 2011 | 12:10 am

thank you both. Ben, do you think you can post an example for those of us who aren’t Javascript programmers?

Mar 17 2011 | 11:08 pm

I don’t think the OP wants to check the state of the patch, IMO he wants to trigger a bang the very moment the patch gets unlocked.

Mar 19 2011 | 6:53 am

Post the code below in a js object, then send the message poll to the object. It will check the state of the patch every 100 milliseconds. If you want to find out the state of the patch just once, send the message lockstate.

var polling = new Task(lockstate);

function lockstate()
{
outlet(0, this.patcher.locked);
}

function poll()
{
polling.interval = 100;
polling.repeat();
}

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

Forums > MaxMSP