home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / opus / v5 / player3_0opus5 / arexx / playhifi_dt.dopus5 < prev    next >
Text File  |  1977-12-31  |  5KB  |  163 lines

  1. /* Programm: PlayHifi_DT.dopus5
  2. ** $VER: PlayHifi_DT.dopus5 1.1 (10-Okt-95)
  3. **
  4. ** 
  5. ** Needed: Directory Opus V5.xx (© by Jonathan Potter & GPSoftware)
  6. **         mpega (© 1995 by Stephane Tavenard) or/and 
  7. **         PeggyPlus MPEG-Card (© Ingenierbuero Helfrich)
  8. **         PeggyPlus:MPEGPlayer >= V4.7
  9. **         Play16 (© 1995 by Thomas Wenzel)
  10. **         PlayADPCM (Autor Christian Buchner)
  11. **
  12. ** Copyright © 1995 Eckhard Ludwig (Eckhard@top.east.de)
  13. ** PlayHifi_DT.dopus5 is freeware. It may be distributed freely.
  14. **
  15. ** Play compressed sound (MPEG Layer 1&2) from DOpus5. Only for DOpus5-filetypes,
  16. ** New: Play AIFF, WAVE, 8SVX, VOC, ADPCM3 (set filetypes doubleclick).
  17. **
  18. ** Localecatalog for german & more: used catalog "PlayHifi.dopus5" !
  19. **
  20. **
  21. ** Call as:
  22. ** --------------------------------------------------------------------------
  23. ** (Doubleklick)   ARexx DOpus5:ARexx/PlayHifi_DT.dopus5 {f} {Qp} {Ql}
  24. ** --------------------------------------------------------------------------
  25. ** Set Attribut: "Output to window" (Ausgabe in Fenster).
  26. ** Set Attribut: "Run asynchron" (Asynchroner Start)
  27. **
  28. */
  29.  
  30. /*--------S E T T I N G S : -------------------------------------------*/
  31. /* If the file ENV:PlayHifi.PREFS exists, that one will override the   */
  32. /* settings here ...                                                   */
  33.  
  34. /*- Path to Player command --------------------------------------------*/
  35. Play16 = "C:Play16"
  36. PL16_OPTIONS=" Paula14 FILTER=OFF"
  37.  
  38. PlayADPCM = "C:PlayADPCM"
  39.  
  40. /*- Path to MPEGPlayer command ----------------------------------------*/
  41. PlayMPEG = "C:mpega"   /* Softwareplayer */
  42. MPEGA_OPTIONS=" -p -f0 -d2 -q2 "  /* edit options for your system ! */
  43.  
  44.  
  45. parse arg '"' Titel '"' portname handle
  46.  
  47. if portname='' then
  48.    portname='DOPUS.1'
  49. address value portname
  50.  
  51. options results
  52. options failat 21
  53. lf='0a'x
  54.  
  55. Index  = 'T:PlayDOpus5Index.temp' /*Name entspricht PlayHifi.dopus5 !*/
  56.  
  57. if open(1,'env:PlayHifi.prefs','R') then do
  58.    do i=1 to 6
  59.     prefs.i = readln(1)
  60.         end
  61.    if prefs.2 ~="" then PLAY16=prefs.2
  62.    if prefs.3 ~="" then PlayADPCM=prefs.3
  63.    if prefs.4 ~="" then PlayMPEG=prefs.4
  64.    if prefs.5 ~="" then PL16_OPTIONS=prefs.5
  65.    if prefs.6 ~="" then MPEGA_OPTIONS=prefs.6
  66. drop prefs.
  67. end
  68. call close(1)
  69.  
  70. if ~show('l','rexxsupport.library') then
  71.     call addlib('rexxsupport.library',0,-30,0)
  72.  
  73. /* init locale */
  74. if ~show(l,'locale.library') then
  75.         call addlib('locale.library',0,-30)
  76. if show(l,'locale.library') then
  77.         catalog=opencatalog('PlayHifi.catalog','english',0)
  78.  
  79. if exists(Index) then do 
  80.    if ~delete(Index) then do
  81.       Index=Index||'1'
  82.       if exists(Index) then call open('output',Index,'A')
  83.        else do
  84.           if open('output',Index,'w') ~=1 then do
  85.              dopus request '"'getcatstr(3,'Error:'lf'Load script in to editor and set path to Index !')'"' getcatstr(1,'Quit')
  86.              exit
  87.              end
  88.        end
  89.    APOS=lastpos("/",Titel)
  90.    if APOS=0 then APOS=lastpos(":",Titel)   
  91.    songname=substr(Titel,APOS+1)
  92.    lister query handle entry '"'songname'"' stem fileinfo.
  93.    call writeln('output',Titel' @SIZE='fileinfo.size' @COMMENT='fileinfo.comment)
  94.    call close('output')
  95.    dopus front 
  96.    dopus request '"'getcatstr(14,'Songs added to playlist')'"' 'OK'
  97.    exit
  98.    end
  99. end
  100.  
  101. dopus getfiletype '"'Titel'"' id
  102. DT=result
  103. if DT="MP2" then do
  104.    if showlist("A","PEGGYPLUS")=1 then do
  105.       if ~show('P','Peggy') then do
  106.         address command 'stack 8192'
  107.         address command 'RUN >NIL: <NIL: PEGGYPLUS:MPEGPlayer'
  108.         address command 'waitforport Peggy'
  109.         address value portname
  110.         dopus front
  111.       end
  112.    end
  113.     if show('P','Peggy') then do
  114.       address 'Peggy'
  115.       open '"'Titel'"'
  116.       setwindow XOFF 0 YOFF 0 WIDTH 1 HEIGHT 1 XPIC 0 YPIC 0
  117.       Play async
  118.       end
  119.    else do
  120.            if ~exists(PlayMPEG) then do
  121.              dopus front
  122.              dopus request '"'getcatstr(9,'Error:'lf'MPEG-Player not found !'lf'path to command: '"'%s'"'',PlayMPEG)'"' getcatstr(1,'Quit')
  123.               exit
  124.              end
  125.       address command PlayMPEG" "MPEGA_OPTIONS" " '"'Titel'"'
  126.       end
  127. exit
  128. end
  129.  
  130. if DT="ADPCM3" then do
  131.     if ~exists(PlayADPCM) then do
  132.           dopus front
  133.           dopus request '"'getcatstr(10,'Error:'lf'ADPCM-Player not found !'lf'path to command: '"'%s'"'',PlayADPCM)'"' getcatstr(1,'Quit')
  134.           end
  135.    else address command PlayADPCM '"'Titel'"' " NOFILTER"
  136.    exit
  137. end
  138.  
  139. if ~exists(Play16) then do
  140.           dopus front
  141.           dopus request '"'getcatstr(11,'Error:'lf'Play16 not found !'lf'path to command: '"'%s'"'',Play16)'"' getcatstr(1,'Quit')
  142.       exit
  143.           end
  144. select
  145.    when DT="CDR" then address command Play16 '"'Titel'"' " RAW FREQ=44100 TRACKS=2 BITS=16 INTEL VERBOSITY=1 "PL16_OPTIONS
  146.    when DT="WAVE" then address command Play16 '"'Titel'"' " "PL16_OPTIONS" VERBOSITY=1"
  147.    when DT="AIFF" then address command Play16 '"'Titel'"' " "PL16_OPTIONS" VERBOSITY=1"
  148.    otherwise address command Play16 '"'Titel'"' " "PL16_OPTIONS" VERBOSITY=1"
  149. end
  150. exit
  151.  
  152. /*--------------------------------------------------------------------------------*/
  153. getcatstr:
  154.    parse arg msgno,msgstring,insert.1,insert.2
  155.    if catalog~=0 then msgstring=getcatalogstr(catalog,msgno,msgstring)
  156.    j=0
  157.    do while pos('%s',msgstring)>0
  158.       parse var msgstring fore '%s' aft
  159.       j=j+1
  160.       msgstring=fore||insert.j||aft
  161.       end
  162.    return msgstring
  163.