home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 93 / af093a.adf / archives / af2.lzx / Extras / Rexx / Remove-Empty-Slots.omed < prev    next >
Text File  |  1984-05-11  |  987b  |  39 lines

  1. /* Removes empty slots between instruments */
  2.  
  3. address 'OCTAMED_REXX'
  4. max_instr = 63
  5. do scnt = 1 to max_instr
  6.     if IsSlotUsed(scnt) then lastinstr = scnt
  7. end
  8. do scnt = 1 to lastinstr-1
  9.     if (IsSlotUsed(scnt) = 0) then do
  10.         cnt2 = scnt + 1
  11.         swapped = 0
  12.         do until (cnt2 > lastinstr) | (swapped = 1)
  13.             if IsSlotUsed(cnt2) then do
  14.                 'in_swapinstruments 'scnt' 'cnt2
  15.                 'rn_changeinum 'scnt' 'cnt2' swap affect=1'
  16.                 swapped = 1
  17.                 if (cnt2 = lastinstr) then do
  18.                     do while (IsSlotUsed(lastinstr) = 0) & (lastinstr > 1)
  19.                         lastinstr = lastinstr - 1
  20.                     end
  21.                 end
  22.             end
  23.             cnt2 = cnt2 + 1
  24.         end
  25.     end
  26. end
  27. 'in_select ins 1'
  28. exit
  29.  
  30. IsSlotUsed:
  31.     arg slt
  32.     'in_select ins 'slt
  33.     'in_isslotused var slotused'
  34.     'in_getmidichannel var midich'
  35.     if (slotused > 0) | (midich > 0) then return 1
  36.     return 0
  37.  
  38.  
  39.