slider/fader springs back to 0? Mouse button release=bang?

Jul 28, 2009 at 8:18pm

slider/fader springs back to 0? Mouse button release=bang?

hi everyone :)

i have an msp slider that when placed in the middle is configured to 0 db.

when i move the slider up to say +3db and let go of the mouse button i hope for the slider to spring back to 0.

So i thought if there is not a slider like this…perhaps there was a module that outputs a 0 when the right mouse button is released..that would enable me to make a little sub patch to make this happen perhaps?.

thanks for any ideas. :P

#44926
Jul 28, 2009 at 8:37pm

Look at [mousestate] the left outlet sends a 1 when the mouse is pressed and a 0 when it is released.

lh

#161778
Jul 28, 2009 at 9:05pm
thereishopeforus@hotmail.com wrote on Tue, 28 July 2009 14:37
Look at [mousestate] the left outlet sends a 1 when the mouse is pressed and a 0 when it is released.

lh

wow nice one!!

i can now simply trigger a number to set the fader back to the correct point ,on release! :P

thanks once again. :)

#161779
Jul 29, 2009 at 1:48am

you can also use [line] to set the “snap back” to however fast or slow you want.

mousestate doesn’t deal with the right mouse button, but the [hi] object might (depending on your mouse), and a jit.pwindow will also report them (as “button-plus-control”). also check out [modifiers].

just some thoughts to play with Smile

#161780
Jul 29, 2009 at 6:09pm

Another solution is to connect the right outlet of the fader to mousefilter, and have the output of mousefilter trigger the return to 0. For example:

– Pasted Max Patch, click to expand. –

The only disadvantage to this method is that adding a line object to the loop complicates things slightly, since it the line will “retrigger” itself. But you can use the line’s built-in ramp value to smooth it out if the visual smoothing isn’t important. On the other hand, the disadvantage of mousestate is that it will trigger the line every time you click on anything, unless you use the mouse position to determine if it is over the fader.

#161781
Jul 29, 2009 at 7:15pm

a custom [lcd] slider seems perfect for this.

#161782
Jul 29, 2009 at 7:37pm

You don’t need to poll the mouse position, you can give your ui object a scripting name and then use [hover].

lh

#161783
Jul 29, 2009 at 8:24pm

hi thanks fo your help.

in the end I used (hover) which lets you select areas (sliders) on the patch via scripting names..and (mousestate) for the release of the left button,using a couple of switches it works pretty well, i made a patch below with two faders to show how it works.

there is the (coll) text file you need to make called coll2.txt , place the text below inside and save it (no arrows) these are scripting names of the faders and the ports which they come out of route.
>

left, 1 left;

right, 2 right;

>

when you open the patch you have to load the coll2.txt into the (coll) module. and click the metro also.

here is the patch > hope it helps someone somewhere

– Pasted Max Patch, click to expand. –
#161784

You must be logged in to reply to this topic.