;;; KEEPCTR.CAL ;;; ;;; A CAL program to "thin" continous controller data. ;;; ;;; For a given controller # event, keeps every N'th event, and those ;;; events whose value is 0, 64, or 127. ;;; ;;; ;;; Prolog (do (int ctlnum 7) ; controller number (int N 4) ; keep every N'th event (int i 0) ; index for moving through (getInt ctlnum "Controller number?" 0 127 ) (getInt N "Keep every Nth event:" 1 100 ) ) ;;; Body (do (if (== Event.Kind CONTROL) (if (== Control.Num ctlnum) (do (switch Control.Val 0 NIL ; don't delete if one of... 64 NIL ; ...these... 127 NIL ; ...values... Control.Val ;default (if (== 0 (% i N)) ; is it the N'th event? NIL (delete) ) ) (++ i) ; this counts ) NIL ) NIL ) ) ;;; Epilog NIL