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

    Jul 28 2009 | 8:18 pm
    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

    • Jul 28 2009 | 8:37 pm
      Look at [mousestate] the left outlet sends a 1 when the mouse is pressed and a 0 when it is released.
    • Jul 28 2009 | 9:05 pm wrote on Tue, 28 July 2009 14:37Look at [mousestate] the left outlet sends a 1 when the mouse is pressed and a 0 when it is released.
      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. :)
    • Jul 29 2009 | 1:48 am
      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
    • Jul 29 2009 | 6:09 pm
      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:
      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.
    • Jul 29 2009 | 7:15 pm
      a custom [lcd] slider seems perfect for this.
    • Jul 29 2009 | 7:37 pm
      You don't need to poll the mouse position, you can give your ui object a scripting name and then use [hover].
    • Jul 29 2009 | 8:24 pm
      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