home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Music Workshop 1
/
Music_Workshop_Walnut_Creek_January_1995.iso
/
mcd
/
unzipped
/
demo
/
cwpro30
/
thinctrl.cal
< prev
next >
Wrap
Text File
|
1993-04-28
|
899b
|
43 lines
;; THIN.CAL
;;
;; A CAL program to "thin" continous controller data.
;;
;; For a given controller # event, deletes every N'th event unless the
;; event's value is 0, 64, or 127.
(do
(include "need20.cal") ; Require version 2.0 or higher of CAL
(int nCtrl 7) ; controller number
(int N 4) ; thin every N'th event
(int i 0) ; index for moving through
(getInt nCtrl "Controller number?" 0 127 )
(getInt N "Delete every Nth event:" 1 100 )
(forEachEvent
(do
(if (&& (== Event.Kind CONTROL) (== Control.Num nCtrl))
(do
(switch Control.Val
; Don't delete if 0, 64, or 127
0
NIL
64
NIL
127
NIL
Control.Val ; default
(if (== 0 (% i N)) ; is it the N'th event?
(delete)
)
)
(++ i) ; this counts
)
)
)
)
)