Mouse click kslider

Mouseclick kslider

In this example, you can play notes by pressing the mouse on the kslider object, and when you release the mouse, the notes will be turned off. When the mouse button is released, that fact is reported by a 0 from the left outlet of the mousestate object. The sel object will detect that 0, and will send a bang to the flush object. The flush object takes pitch and velocity values in its inlets, keeps track of which notes have not yet been turned off with a 0 velocity, and when it gets the message bang in its left inlet it sends out all currently held pitches accompanied by a velocity 0 to turn off all the notes. The initial poll message to mousestate turns on automatic reporting of all changes in the state or position of the mouse. (A nopoll message would be used to deactivate that automatic reporting.)

Chapter: 
Keywords: