home *** CD-ROM | disk | FTP | other *** search
/ Hope PC Multimedia SuperPack 2 / HOMEPC.iso / CAKEWALK / THINCTRL.CA_ / THINCTRL.bin
Text File  |  1996-02-22  |  899b  |  43 lines

  1. ;; THIN.CAL
  2. ;;
  3. ;; A CAL program to "thin" continous controller data.
  4. ;;
  5. ;; For a given controller # event, deletes every N'th event unless the
  6. ;; event's value is 0, 64, or 127.
  7.  
  8. (do
  9.     (include "need20.cal")    ; Require version 2.0 or higher of CAL
  10.  
  11.     (int nCtrl 7)    ; controller number
  12.     (int N 4)        ; thin every N'th event
  13.     (int i 0)            ; index for moving through
  14.  
  15.     (getInt nCtrl "Controller number?" 0 127 )
  16.     (getInt N "Delete every Nth event:" 1 100 )
  17.  
  18.     (forEachEvent
  19.         (do
  20.             (if (&& (== Event.Kind CONTROL) (== Control.Num nCtrl))
  21.                 (do
  22.                     (switch Control.Val
  23.                         ; Don't delete if 0, 64, or 127
  24.                         0        
  25.                             NIL
  26.                         64       
  27.                             NIL
  28.                         127      
  29.                             NIL
  30.  
  31.                         Control.Val    ; default
  32.                             (if (== 0 (% i N))   ; is it the N'th event?
  33.                              (delete)
  34.                             )
  35.                     )
  36.                     (++ i)    ; this counts
  37.                 )
  38.             )
  39.         )
  40.     )
  41. )
  42.  
  43.