home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Sound / MUImp3 / MUImp3.mmp < prev    next >
Text File  |  2000-01-01  |  10KB  |  506 lines

  1. /* */
  2.  
  3. parse arg name
  4. options results
  5.  
  6. if ~show('L',"rexxtricks.library") then call addlib('rexxtricks.library',0,-30,0)
  7.  
  8. option = word(name,1)
  9. target = substr(name,length(option)+2)
  10. prefs = 'envarc:MUImp3.prefs'
  11. sorted = -2
  12. TRUE = 1
  13. FALSE = 0
  14.  
  15. if option="DISABLE" THEN DO
  16. ADDRESS MUImp3
  17. GROUP id BUTT ATTRS 0x80423661 TARGET
  18. exit
  19. end
  20.  
  21. if option="CHANGE" then do
  22. address MUImp3
  23. text id mes2
  24. line = result
  25. if line = "" then exit
  26. nr = left(target,1)
  27. target = right(target,length(target)-1)
  28. call open('work',makepath('projects',line),'R')
  29. a = 0
  30. do until eof('work')
  31.  a = a + 1
  32.  file.a = readln('work')
  33. end
  34.  ns = a - 1
  35. call close('work')
  36. file.nr = target
  37. call open('work',makepath('projects',line),'W')
  38. do a = 1 to ns
  39.  call writeln('work',file.a)
  40. end
  41. call close('work')
  42. exit
  43. end
  44.  
  45. if option="ATTOF" then do
  46. address MUImp3
  47. list id song attrs 0x80421654
  48. nr = result
  49. list id song
  50. temp = maketemp('t:')
  51. call open('work',temp,'W')
  52. do a = 0 to nr-1
  53. address MUImp3
  54. list id song pos a
  55. line = result
  56. list id song
  57. if left(line,2)="ID" then call writeln('work','rx MUImp3.mmp TTOF' line)
  58. end
  59. call close('work')
  60. address command
  61. 'execute' temp
  62. 'delete >nil:' temp
  63. exit
  64. end
  65.  
  66.  
  67. if option="TTOF" then do
  68.  address MUImp3
  69.  line = target
  70.  if target = "" then do
  71.  list id song
  72.  line = result
  73.  list id song
  74.  end
  75.  if left(line,4)="FILE" then do
  76.   text id mes3 label "No CD-Track"
  77.   exit
  78.  end
  79.  call open('work',prefs,'R')
  80.  do a = 1 to 13
  81.   targ.a = readln('work')
  82.  end
  83.  call close('work')
  84.  call open('work',makepath('projects',line),'R')
  85.  a = 0
  86.  do until eof('work')
  87.   a = a + 1
  88.   file.a = readln('work')
  89.  end
  90.  call close('work')
  91.  temp = maketemp(targ.11)
  92.  nr = value(right(line,2))
  93.  com1 = 'cdda mute' targ.3 'track' nr 'file' temp
  94.  address command
  95.  'rx MUImp3.mmp MESSAGE Read Track' nr
  96.  'rx MUImp3.mmp DISABLE 1'
  97.  com1
  98.  'rx MUImp3.mmp ADDFILE' temp
  99.  call open('work',makepath('projects','FILE_'||filepart(temp)),'R')
  100.  a = 0
  101.  do until eof('work')
  102.   a = a + 1
  103.   targ.a = readln('work')
  104.  end
  105.  call close('work')
  106.  do a = 1 to 6
  107.   line.a = file.a
  108.  end
  109.  line.7 = targ.7
  110.  line.8 = targ.8
  111.  call open('work',makepath('projects','FILE_'||filepart(temp)),'W')
  112.   do a = 1 to 8
  113.    call writeln('work',line.a)
  114.   end
  115.  call close('work')
  116.  address command
  117.  'rx MUImp3.mmp MESSAGE' Ready
  118.  'rx MUImp3.mmp REMOVE' line
  119.  'rx MUImp3.mmp DISABLE 0'
  120. exit
  121. end
  122.  
  123. if option="CONVALL" then do
  124. address MUImp3
  125. list id song attrs 0x80421654
  126. nr = result
  127. list id song
  128. temp = maketemp('t:')
  129. call open('work',temp,'W')
  130. do a = 0 to nr-1
  131. address MUImp3
  132. list id song pos a
  133. line = result
  134. list id song
  135. call writeln('work','rx MUImp3.mmp CONVERT' line)
  136. end
  137. call close('work')
  138. address command
  139. 'execute' temp
  140. 'delete >nil:' temp
  141. exit
  142. end
  143.  
  144. if option="CONVERT" then do
  145.  address MUImp3
  146. if target = "" then do
  147.  list id song
  148.  line = result
  149.  list id song
  150. end
  151. else line = target
  152.  call open('work',prefs,'R')
  153.  do a = 1 to 13
  154.   line.a = readln('work')
  155.  end
  156.  call close('work')
  157.  call open('work',makepath('projects',line),'R')
  158.  a = 0
  159.  do until eof('work')
  160.   a = a + 1
  161.   file.a = readln('work')
  162.  end
  163.  call close('work')
  164.  com = line.4
  165.  if line.5 = 1 then com = com '-c'
  166.  if line.6 = 1 then com = com '-o'
  167.  if line.7 = 1 then com = com '-r'
  168.  if line.8 = 1 then com = com '-x'
  169.  com = com '-b' line.9
  170.  if line.10 ~= "Auto" then do
  171.   if line.10 = "Stereo" then com = com '-s'
  172.   else com = com '-m'
  173.  end
  174.  com = com '-t' '"'file.1'"'
  175.  com = com '-a' '"'file.2'"'
  176.  com = com '-l' '"'file.3'"'
  177.  com = com '-y' '"'file.4'"'
  178.  com = com '-e' '"'file.5'"'
  179.  com = com '-g' '"'file.6'"'
  180.  
  181.  nr = value(right(line,2))
  182.  temp2 = maketemp(line.11)
  183.  com1 = 'cdda mute' line.3 'track' nr 'file' temp2
  184.  temp = maketemp('t:')
  185.  call open('work',temp,'W')
  186.  if left(line,2)="ID" then do
  187.  com = com '"'temp2'"' '"'file.7'"'
  188.  call writeln('work','stack 500000')
  189.  call writeln('work','rx MUImp3.mmp MESSAGE Read Track '||nr)
  190.  call writeln('work',com1)
  191.  call writeln('work','rx MUImp3.mmp MESSAGE Convert Track '||nr)
  192.  call writeln('work',com)
  193.  call writeln('work','rx MUImp3.mmp SONGUP' line) 
  194.  call writeln('work','delete >nil:' temp2)
  195.  call writeln('work','rx MUImp3.mmp MESSAGE Ready')
  196.  end
  197.  else do
  198.  com = com '"'file.8'"' '"'file.7'"'
  199.  call writeln('work','stack 500000')
  200.  call writeln('work','rx MUImp3.mmp MESSAGE Convert File '||file.8)
  201.  call writeln('work',com)
  202.  call writeln('work','rx MUImp3.mmp MESSAGE Ready')
  203.  end
  204.  call close('work')
  205.  address command
  206.  'rx MUImp3.mmp DISABLE 1'
  207.  'execute >nil:' temp
  208.  'delete >nil:' temp
  209.  'rx MUImp3.mmp DISABLE 0'
  210. exit
  211. end
  212.  
  213. if option="MESSAGE" then do
  214. address MUImp3
  215. text id mes3 label target
  216. exit
  217. end
  218.  
  219. if option="SONGUP" then do
  220. address command
  221. 'delete >nil:' makepath('projects',target)
  222. address MUImp3
  223. list id song remove string target
  224. list id song
  225. exit
  226. end
  227.  
  228. if option="REMOVE" then do
  229. line = target
  230. address MUImp3
  231. if target="" then do
  232.  list id song
  233.  line = result
  234. end
  235. if line = "" then exit
  236. list id song remove string line
  237. list id song
  238. address command
  239. 'delete >nil:' makepath('projects',line)
  240. exit
  241. end
  242.  
  243. if option="SHOWINFO" then do
  244.  call open('work',makepath('projects',target),'R')
  245.  a = 0
  246.  do until eof('work')
  247.   a = a + 1
  248.   line.a = readln('work')
  249.  end
  250.  call close('work')
  251.  address MUImp3
  252.  text id mes2 label target
  253.  string id mpt content line.1
  254.  string id mpr content line.2
  255.  string id mpa content line.3
  256.  string id mpy content line.4
  257.  string id mpe content line.5
  258.  string id mpg content line.6 
  259. exit
  260. end
  261.  
  262. if option="ADDFILE" then do
  263.  address MUImp3
  264.  if target="" then do
  265.   text id mes3 label "Drop one AIFF-16Bit File on Projects-List"
  266.   exit
  267.  end
  268.  call open('work',prefs,'R')
  269.  do a = 1 to 13
  270.   targ.a = readln('work')
  271.  end
  272.  call close('work')
  273.  
  274.  line.0 = "FILE_"||filepart(target)
  275.  line.1 = filepart(target)
  276.  line.2 = ""
  277.  line.3 = ""
  278.  line.4 = right(date('N'),4)
  279.  line.5 = "MUImp3 robin@amiganiac.de" filepart(target)
  280.  line.6 = ""
  281.  line.7 = makepath(targ.12,filepart(target))
  282.  line.7 = makesuffix(line.7,'mp3',R)
  283.  line.8 = target
  284.  call open('work',makepath('projects',line.0),'W')
  285.  do a = 1 to 8
  286.   call writeln('work',line.a)
  287.  end
  288.  list id song insert nodup pos sorted string line.0
  289.  list id song
  290. exit
  291. end
  292.  
  293.  
  294.  
  295. if option="ADDCD" then do
  296.  address MUImp3
  297.  text id mes1
  298.  cdid = result
  299.  if ~index(cdid,'ID') then do
  300.   address command 
  301.   'rx MUImp3.mmp GETID'
  302.   address MUImp3
  303.   text id mes1
  304.   cdid = result
  305.  end
  306.  call open('work',prefs,'R')
  307.  do a = 1 to 13
  308.   line.a = readln('work')
  309.  end
  310.  call close('work')
  311.  slider id mint
  312.  min1 = result
  313.  slider id maxt
  314.  max1 = result 
  315.  if ~exists('projects') then do
  316.   address command
  317.   'makedir >nil: projects'
  318.   address MUImp3
  319.  end
  320.  do a = min1 to max1
  321.   file.0 = cdid||"-"||overlay(a,'00',3-length(a))
  322.   title.0 = ""
  323.   title.1 = cdid
  324.   c = a + 1
  325.   title.c = file.0
  326.   if exists(line.13||cdid) then do
  327.    call open('work',line.13||cdid,'R')
  328.    b = 0
  329.    do until eof('work')
  330.     title.b = readln('work')
  331.     title.b = remsig(title.b)
  332.     b = b + 1
  333.    end
  334.    call close('work')
  335.   end
  336.   c = a + 1
  337.   file.1 = title.c
  338.   file.2 = title.0
  339.   file.3 = title.1
  340.   file.4 = ""
  341.   file.5 = "MUImp3 robin@amiganiac.de" file.0
  342.   file.6 = ""
  343.   file.7 = makepath(line.12,file.1||'.mp3')
  344.   call open('work','projects/'file.0,'W')
  345.   do b = 1 to 7
  346.    call writeln('work',file.b)
  347.   end
  348.   call close('work')
  349.   address MUImp3
  350.   list id song insert nodup pos sorted string file.0
  351.   list id song
  352.  end
  353. exit
  354. end
  355. if option="SCHECK" then do
  356.  address MUImp3
  357.  slider id mint
  358.  min1 = result
  359.  slider id maxt
  360.  max1 = result
  361.  if min1 > max1 then slider id maxt attrs 0x8042ae3a min1
  362.  if max1 < min1 then slider id mint attrs 0x8042ae3a max1
  363. exit
  364. end
  365. if option="GETID" then do
  366.  file = "ID"
  367.  temp = maketemp('t:')
  368.  call open('work',prefs,'R')
  369.  do a = 1 to 13
  370.   line.a = readln('work')
  371.  end
  372.  call close('work')
  373.  address command
  374.  'cdda mute list' line.3 '>'||temp
  375.  call open('work',temp,'R')
  376.  a = 0
  377.  do until eof('work')
  378.   a = a + 1
  379.   track.a = readln('work')
  380.  end
  381.  call close('work')
  382.  'delete >nil:' temp
  383.  nr = a - 3
  384.  file = file||overlay(nr,'00',3-length(nr))||'0'
  385.  if nr > 1 then do 
  386.   file1 = d2x(value(word(track.2,6))+value(word(track.3,6)))
  387.   if length(file1)<5 then file1=overlay(file1,'00000',6-length(file1))
  388.  end
  389.  else file1 = '00000'
  390.  file = file||file1||'0'
  391.  a = nr + 2
  392.  file1 = d2x(value(word(track.a,6)))
  393.  file = file||file1
  394.  address MUImp3
  395.  text id mes1 label file
  396.  slider id mint attrs 0x8042d78a nr 0x8042e404 1 0x8042ae3a 1
  397.  slider id maxt attrs 0x8042d78a nr 0x8042e404 1 0x8042ae3a nr
  398. exit
  399. end
  400.  
  401. if option="INIT" then do
  402.  if ~exists(prefs) then do
  403.   address MUImp3
  404.   cycle id bitr label "128"
  405.   address command
  406.   'rx MUImp3.mmp SAVE'
  407.  end
  408.  address command
  409.  'rx MUImp3.mmp LOAD'
  410.  temp = maketemp('t:')
  411.  if ~exists('projects') then 'makedir projects'
  412.  'list projects lformat %s >'||temp
  413.  call open('work',temp,'R')
  414.  call readfile(temp,line)
  415.  call close('work')
  416.  'delete >nil:' temp
  417.  address MUImp3
  418.  do a = 1 to line.0
  419.   list id song pos sorted insert nodup string line.a
  420.  end
  421. exit
  422. end
  423.  
  424. if option="LOAD" then do
  425. call open('work',prefs,'R')
  426. do a = 1 to 13
  427. line.a = readln('work')
  428. end
  429. call close('work')
  430. call setenv(CDDA_DEVICE,line.1)
  431. call setenv(CDDA_UNIT,line.2)
  432. address MUImp3
  433. string id cdev content line.1
  434. slider id cdun attrs 0x8042ae3a line.2 
  435. cycle id plan label line.3
  436. popasl id path content line.4
  437. check id copy attrs 0x8042654b line.5 
  438. check id orig attrs 0x8042654b line.6
  439. check id crc attrs 0x8042654b line.7
  440. check id max attrs 0x8042654b line.8
  441. cycle id bitr label line.9
  442. cycle id ster label line.10
  443. popasl id temp content line.11
  444. popasl id dest content line.12
  445. popasl id cdid content line.13
  446.  
  447. exit
  448. end
  449. if option="SAVE" then do
  450. address MUImp3
  451. string id cdev
  452. line.1 = result
  453. slider id cdun 
  454. line.2 = result
  455. cycle id plan
  456. line.3 = result
  457. popasl id path
  458. line.4 = result
  459. check id copy
  460. line.5 = result
  461. check id orig
  462. line.6 = result
  463. check id crc
  464. line.7 = result
  465. check id max
  466. line.8 = result
  467. cycle id bitr
  468. line.9 = result
  469. cycle id ster
  470. line.10 = result
  471. popasl id temp
  472. line.11 = result
  473. popasl id dest
  474. line.12 = result
  475. popasl id cdid
  476. line.13 = result
  477.  
  478. call setenv(CDDA_DEVICE,line.1)
  479. call setenv(CDDA_UNIT,line.2)
  480. call open('work',prefs,'W')
  481. do a = 1 to 13
  482. call writeln('work',line.a)
  483. end
  484. call close ('work')
  485. exit
  486. end
  487.  
  488.  
  489. exit
  490. remsig:
  491. parse arg rems
  492. remt = translate(rems,"_-","/~#?*||","_")
  493. say remt
  494. return remt
  495.  
  496. maketemp:
  497. parse arg path
  498. a = 1
  499. temp = makepath(path,'MUImp3.1.tmp')
  500. do while exists(temp)
  501. a = a + 1
  502. temp = makepath(path,'MUImp3.'a'.tmp')
  503. end
  504. call open('work',temp,'W')
  505. call close('work')
  506. return temp