51 lines
991 B
Text
51 lines
991 B
Text
class:: MouseButton
|
|
summary:: Mouse button UGen.
|
|
related:: Classes/KeyState, Classes/MouseX, Classes/MouseY
|
|
categories:: UGens>User interaction
|
|
|
|
|
|
Description::
|
|
|
|
Mouse button UGen.
|
|
|
|
|
|
classmethods::
|
|
|
|
method::kr
|
|
|
|
argument::minval
|
|
|
|
Value when the button is not pressed.
|
|
|
|
|
|
argument::maxval
|
|
|
|
Value when the button is pressed.
|
|
|
|
|
|
argument::lag
|
|
|
|
Lag factor.
|
|
|
|
|
|
Examples::
|
|
|
|
code::
|
|
|
|
{ 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;
|
|
::
|
|
|