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

  1. ; BANKSELP.CAL
  2. ;
  3. ; This routine will insert a Bank Select combination into a selected track.
  4. ; This is for instruments which use a "two patch changes" method for
  5. ; selecting banks, prior to the official Bank Select method being
  6. ; agreed on.
  7.  
  8. (do
  9.     (dword time Now)    
  10.     (getTime time "Insert Bank/Patch change at time:")
  11.  
  12.     (int pat1 0)
  13.     (getInt pat1 "Bank (0..127):" 0 127)
  14.  
  15.     (int pat2 0)
  16.     (getInt pat2 "Patch (0..127):" 0 127)
  17.  
  18.     ; Delete existing bank-change events around this time.
  19.     ; The spread of 3 ticks is because below we insert the events
  20.     ; spread apart by a tick each to ensure their ordering.
  21.     ; Although this CAL routine is for instruments which use a
  22.     ; pair of patch changes, perhaps the user had been using
  23.     ; the BANKSEL.CAL program, and has CONTROL bank events
  24.     ; here which they won't need.  So delete those too.
  25.     (= From time)
  26.     (= Thru (+ time 2))
  27.  
  28.     (forEachEvent
  29.         (do
  30.             (if (&& (== Event.Kind CONTROL) (== Control.Num 0))
  31.                 (delete)
  32.                 (if (&& (== Event.Kind CONTROL) (== Control.Num 32))
  33.                     (delete)
  34.                     (if (== Event.Kind PATCH)
  35.                         (delete)
  36.                     )
  37.                 )
  38.             )
  39.         )
  40.     )
  41.  
  42.     ; Insert the new events.
  43.     (insert time 0 PATCH pat1)
  44.     (insert (+ time 1) 0 PATCH pat2)
  45. )
  46.