[CM] Triggers

Heinrich Taube taube at uiuc.edu
Tue Apr 7 15:32:09 PDT 2009


svn trunk now provides a new GUI tool in Grace called a Trigger that  
you can attach to Editor windows for interactive evaluation.
There are four types of triggers: Buttons, Sliders, Keyboards and  
MidiIn (The keyboard component wont be there for a few more days)

To add a trigger to your buffer use the Eval>Triggers submenu. Once a  
trigger is attached manipulate it to evaluate the buffer or buffer  
selection. Any data a trigger generates will be available in your  
buffer code in variables you set up. Triggers can be configured  
interactively and restored/saved to XML descriptions that look like  
this:  ; <trigger type="button" label="Hiho!"  />

to try out triggers using the xml importing/exporting feature do this:

1 Create a new lisp buffer and paste these two lines into it:

;; <trigger type="button" variable="*trig*" value="(random 100)" />

(format #t "my random value=~a~%" *trig*)


2 now Select the comment line as a region with your mouse then choose  
Eval>Triggers>New from Region.  that will parse the xml inthe comment  
and create a trigger for the buffer.
3 now click on the button in the trigger and look in the console for  
the output.


Here is one that will send whole tone midi notes when you move the  
slider:

;; <trigger type="slider" variable="*trig*" range="60 90 2" />

(mp:midi :key *trig*)




More information about the Cmdist mailing list