/* Removes empty slots between instruments */ address 'OCTAMED_REXX' max_instr = 63 do scnt = 1 to max_instr if IsSlotUsed(scnt) then lastinstr = scnt end do scnt = 1 to lastinstr-1 if (IsSlotUsed(scnt) = 0) then do cnt2 = scnt + 1 swapped = 0 do until (cnt2 > lastinstr) | (swapped = 1) if IsSlotUsed(cnt2) then do 'in_swapinstruments 'scnt' 'cnt2 'rn_changeinum 'scnt' 'cnt2' swap affect=1' swapped = 1 if (cnt2 = lastinstr) then do do while (IsSlotUsed(lastinstr) = 0) & (lastinstr > 1) lastinstr = lastinstr - 1 end end end cnt2 = cnt2 + 1 end end end 'in_select ins 1' exit IsSlotUsed: arg slt 'in_select ins 'slt 'in_isslotused var slotused' 'in_getmidichannel var midich' if (slotused > 0) | (midich > 0) then return 1 return 0