SuperCollider CLASSES

MouseButton

Mouse button UGen.
Inherits from: UGen : AbstractFunction : Object

Description

Mouse button UGen.

Class Methods

*kr (minval: 0, maxval: 1, lag: 0.2)

Arguments:

minval

Value when the button is not pressed.

maxval

Value when the button is pressed.

lag

Lag factor.

Inherited class methods

Instance Methods

Inherited instance methods

Undocumented instance methods

-signalRange

Examples

{ SinOsc.ar(MouseButton.kr(400, 440, 0.1), 0, 0.1) }.play;
{ SinOsc.ar(MouseButton.kr(400, 740, 2), 0, 0.1) }.play;

(
SynthDef( \mousexyb, { |out=0|
    var mousex, mousey, mousebutton;
    mousex = MouseX.kr( 500, 1000 ); // this will determine the frequency of the sound (minimum value, maximum value, warp, lag)
    mousey = MouseY.kr( 0, 0.3 ); // this will determine the amplitude of the sound
    mousebutton = MouseButton.kr( 0, 1, 2 ); // this will turn the sound on or off (minimum value, maximum value, lag)
    Out.ar( out, SinOsc.ar( mousex, 0, mousey ) * mousebutton );
}).add
)

x = Synth.new( \mousexyb );
x.free;