keeping slider in position

kala's icon

Hello all
I'd like a joystick controler to keep its position, and not going back to its initial position. All i managed to do is creating stack overfows. Sounds like a noob question but i'm sure you guys know how to resolve it.
cheers
ka

kala's icon

yes exactly (but for this you just need to remove the spring !!!)
but also kind of buttons which actually send 0 to 255 values and then go back to the 0 position. How can I "freeze" it ?

brendan mccloskey's icon

Hi kala
the simplest method would be to store the number in [int] and use a [bang] from [change +] to trigger it; or use [change +], [change -] and a [gate]; these objects output a 1 or -1 when the value is either rising or falling, allowing one to open and close the gate:

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

As you can see, the first method is more accurate.

There are individual objects which perform a similar task, such as [peak], [past] and [maximum], but I find it tricky to operate on realtime number stream input in this way; I guess they are designed to handle lists, but look at the helpfiles for these guys too.

Brendan

kala's icon

cheers !

brendan mccloskey's icon

I looked again at this and found that the reason for the unreliability of the [gate] method is due to the control flow ordering of Max: from right to left, so one descending number will 'sneak' through the gate before it is closed; the solution is to insert a [pipe 1] object before the [gate]'s RIGHT inlet.

But the [int] method is way simpler

Brendan