home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 93 / af093a.adf / archives / af2.lzx / Extras / Rexx / OrgInsts.omed < prev    next >
Text File  |  1984-03-11  |  1KB  |  58 lines

  1. /* Organize Instruments - Ed Wiles, 20th March 1995 */
  2.  
  3. address OCTAMED_REXX
  4. options results
  5.  
  6. 'in_select lu'
  7. 'in_getnumber'; last = result
  8.  
  9. if last = 1 then do
  10.    'in_isslotused'
  11.    if result then 'wi_showstring Only one instrument in song!'
  12.    else 'wi_showstring No instruments in song!'
  13.    exit
  14. end
  15.  
  16. in_select 1
  17. in_isslotused
  18.  
  19. if result = 0 then
  20.    emptyslot = 1
  21. else do
  22.    'in_select nextfree'
  23.    'in_getnumber'; emptyslot = result
  24.  
  25.    if (emptyslot = 1) | (emptyslot > last) then do
  26.       'in_select 1'
  27.       'wi_showstring Instruments already organized.'
  28.       exit
  29.    end
  30. end
  31.  
  32. 'wi_showstring Organizing instruments...'
  33.  
  34. nextfull = 2
  35.  
  36. do until nextfull > last
  37.    do while nextfull <= last
  38.       'in_select' nextfull
  39.       'in_isslotused'
  40.  
  41.       if result = 1 then break
  42.  
  43.       nextfull = nextfull + 1
  44.    end
  45.  
  46.    if nextfull <= last then do
  47.       'in_swapinstruments' emptyslot nextfull
  48.       'rn_changeinum' emptyslot nextfull 'swap'
  49.       emptyslot = emptyslot + 1
  50.       nextfull = nextfull + 1
  51.    end
  52. end
  53.  
  54. 'in_select lu'
  55. 'in_getnumber'
  56. 'wi_showstring Instruments organized. Song has 'result' instruments.'
  57. 'in_select 1'
  58.