home *** CD-ROM | disk | FTP | other *** search
/ MIDI Music Collection / MUSIC.iso / cakewalk.201 / disk1 / banksel.ca_ / banksel.bin
Encoding:
Text File  |  1994-02-01  |  1.1 KB  |  48 lines

  1. ; BANKSEL.CAL
  2. ;
  3. ; This routine will insert a Bank Select combination into a selected track
  4. ; The user may change the NOW time for the insertion.
  5. ;
  6. ; This routine works in both Cakewalk Professional for Windows and 
  7. ; Cakewalk Professional for DOS.  Enjoy!
  8. ;
  9.  
  10. (do
  11.     (dword time Now)    
  12.     (getTime time "Insert Bank/Patch change at time:")
  13.  
  14.     (int msb 0)
  15.     (getInt msb "Bank MSB/Controller 0 (0..127):" 0 127)
  16.  
  17.     (int lsb 0)
  18.     (getInt lsb "Bank LSB/Controller 32 (0..127):" 0 127)
  19.  
  20.     (int pat 0)
  21.     (getInt pat "Patch Number (0..127):" 0 127)
  22.  
  23.     ; Delete existing bank-change events around this time.
  24.     ; The spread of 3 ticks is because below we insert the events
  25.     ; spread apart by a tick each to ensure their ordering.
  26.     (= From time)
  27.     (= Thru (+ time 2))
  28.  
  29.     (forEachEvent
  30.         (do
  31.             (if (&& (== Event.Kind CONTROL) (== Control.Num 0))
  32.                 (delete)
  33.                 (if (&& (== Event.Kind CONTROL) (== Control.Num 32))
  34.                     (delete)
  35.                     (if (== Event.Kind PATCH)
  36.                         (delete)
  37.                     )
  38.                 )
  39.             )
  40.         )
  41.     )
  42.  
  43.     ; Insert the new events
  44.     (insert time 0 CONTROL 0 msb)
  45.     (insert (+ time 1) 0 CONTROL 32 lsb)
  46.     (insert (+ time 2) 0 PATCH pat)
  47. )
  48.