Buscar

C NTROLR

Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original

;;; Robert C. Prince, III Cakewalk Pro SN: 406176-CP-4.0A
;;; P. O. Box 8043
;;; Athens, GA 30603-8043
;;; (404) 725-1014
;;;
;;; CONTROLR.CAL
;;;
;;; This is a CAL program that allows the user to change data for any
;;; controller using addition or subtaction of a fixed amount, a high
;;; and low boundary, or a percentage.
;;;
;;; NOTE: This program automatically deletes any consecutive duplicate
;;; controller values that are on the same MIDI channel.
;;;
;;; *********************************************************************
;;; Prolog
(do
 ; set variables
 (int wtd 1) ; what user wants to do, fixed change default
 (int ctrlr 7) ; which controller to affect, volume (7) is default
 (int Fixed 1) ; if wtd=1 user wants fixed add/subtract
 (int HiLo 2) ; if wtd=2 user wants hi low boundaries
 (int Pct 3) ; if wtd=3 user wants percentage
 (int c 0) ; counter to let user know something's happening
 (int TEP 0) ; total events processed
 (int TCVS 0) ; Temporary Controller Value Saver
 (int TCCS 18) ; Temporary Controller Channel Saver
 (int d 0) ; # dupes eliminated
 ; get which controller user wants to affect
 (getInt ctrlr "Controller Number: " 1 127)
 ; get what user wants to do with the controller data
 (getInt wtd "Fixed=1 Hi/Low=2 Percentage=3:" 1 3)
 ; now set the variables according to the task to complete
 (switch wtd
 
 ;if user chose Fixed, do the following
 Fixed (do
 (int amt 10)
 (getInt amt "Amount to add?" -127 127)
 )
 ; if user chose Hi/Low, do the following
 HiLo (do
 (int H 127) ; the highest data allowed
 (int L 0) ; the lowest data allowed
 (getInt H "Highest amount:" 0 127 ) ; get Hi
 (getInt L "Lowest amount:" 0 127 ) ; get the Low
 )
 ; if user chose Percentage, do the following
 Pct (do
 (int percent 100)
 (getInt percent "Percentage?" 1 1000)
 )
 ;close off the switch parens
 )
;close off the do parens
)
;;; *********************************************************************
;;; Body
;;;
(do
 ; let user know something's being done
 (message "Controller " ctrlr
 "Events: " c
 " Total Events: " TEP
 " Duplicates Deleted: " d
 )
 ; bump up total events processed
 (++ TEP)
 ; if the kind of event is a controller do something
 (if (== Event.Kind CONTROL)
 ; yes it is a controller event, so see if it matches user's choice
 (if (== Control.Num ctrlr)
 ; yes it matches user's choice
 (do
 (switch wtd
 ; if user chose Fixed, do the following
 Fixed (+= Control.Val amt)
 ; if user chose Hi/Low, do the following
 HiLo (do
 ; is the data less than L?
 (if (< Control.Val L)
 ; YES, so make it equal L
 (= Control.Val L)
 ; NO -- move on to next question
 NIL
 ; close off the if paren
 )
 ; is the data greater than H?
 (if (> Control.Val H)
 ; YES, so make it equal H
 (= Control.Val H)
 ; NO -- move on to next event
 NIL
 ; close off the if paren
 )
 ;close off the do paren
 )
 ; if user chose Percentage, do the following
 Pct
 (do
 ; multiply data by percent
 (*= Control.Val percent)
 ; divide result by 100
 (/= Control.Val 100)
 ;close off do paren
 )
 ;close off switch paren
 )
 ; bump counter up
 (++ c)
 ; delete any duplicates
 (if (&& (== Control.Val TCVS) (== Event.Chan TCCS))
 ; yes it is a duplicate on the same MIDI channel
 (do
 (delete)
 (++ d) ;; bump the # deletes counter up
 )
 ; no it is not a dupe, so store it's value and Chan #
 (do
 (= TCVS Control.Val)
 (= TCCS Event.Chan)
 )
 )
 ; close the yes event matches user's choice do paren
 )
 ; no, it does not match user's choice, so do nothing
 NIL
 ; close of if controller number matches user's choice paren
 )
 ; no it is not a controller event, so do nothing
 NIL
 ; close off if event is controller paren
 )
; close off body/do paren
)
;;; *********************************************************************
;;; Epilog
;;;
NIL

Teste o Premium para desbloquear

Aproveite todos os benefícios por 3 dias sem pagar! 😉
Já tem cadastro?

Outros materiais