home *** CD-ROM | disk | FTP | other *** search
/ Boot Disc 4 / boot-disc-1996-12.iso / Apps / Cakewalk / PROAUD45 / RANDTIME.CA_ / RANDTIME.bin
Text File  |  1996-05-20  |  640b  |  34 lines

  1. ;; Randtime.cal
  2. ;;
  3. ;; Sort of an "un-quantize" command.
  4.  
  5. (do
  6.     (include "need20.cal")    ; Require version 2.0 or higher of CAL
  7.  
  8.     (dword wid 30)
  9.     (dword widDiv2)
  10.     (int ofs)
  11.  
  12.     (getInt wid "Random time window (in ticks)?" 0 480)
  13.     (= widDiv2 (/ wid 2))
  14.  
  15.     (forEachEvent
  16.         (do
  17.             (= ofs (random 0 wid))
  18.             (= ofs (- ofs widDiv2))
  19.  
  20.             (if (< ofs 0)      ; if shifting earlier
  21.                  (if (> (* ofs -1) Event.Time)  ; if more than start time
  22.                     (do
  23.                         (= ofs Event.Time)    ; make it equal to start time
  24.                         (= ofs (* ofs -1))    ; restore to negative
  25.                     )
  26.                 )
  27.             )
  28.  
  29.             (+= Event.Time ofs)  ; do it!
  30.         )
  31.     )
  32. )
  33.  
  34.