This class is meant as an emulation of the MouseButton UGen. last mod: 30-jul-07 sciss
This class replaces the UGen by a control bus reader. It does not really track the mouse button ; instead you can write the virtual mouse button states (0 or 1) onto this control bus or use a GUI panel as shown in the example code below.
different behaviour | |
class | this is not a UGen subclass, so in rare circumstances there are incompatibilities |
Note: please use the abstraction layer GUI.mouseButton if possible! (see GUI)
JMouseButton
acts like a user-interface UGen. It outputs a control rate signal that reflects the state of the (left) mouse button.
JMouseButton.kr( <minval>, <maxval>, <lag> )
minval
– value when the button is not pressedmaxval
– value when the button is pressedlag
– a lag factor (-60 dB time) so that the transition between pressed / not pressed becomes smooth
Example:
s.boot; { SinOsc.ar( JMouseButton.kr( 400, 440, 0.1 ), 0, 0.1 )}.play; { SinOsc.ar( JMouseButton.kr( 400, 740, 2 ), 0, 0.1 )}.play; JMouseButton.set( 1 ); JMouseButton.set( 0 ); // or use a GUI to control (requires SwingOSC server running) JMouseBase.makeGUI; // optional arg is panel size!