home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / cplayv20.zip / cplay.cmd next >
OS/2 REXX Batch file  |  1993-07-07  |  2KB  |  78 lines

  1. /* cplay2.cmd */
  2.  
  3. '@echo off'
  4. call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
  5. initcode = VInit()
  6. if (initcode = 'ERROR') then signal CLEANUP
  7.  
  8. signal on failure name CLEANUP
  9. signal on halt name CLEANUP
  10. signal on syntax name CLEANUP
  11.    
  12. arg rate file
  13.  
  14. /* Re-arrange Arguments if necessary*/
  15. if datatype(rate)=char then do
  16.    temp = rate
  17.    rate = file
  18.    file = temp
  19. end
  20.  
  21. /* File Selection Box*/
  22. if (file = '') then do
  23.    button = VFileBox('CPLAY- Audio File Player', '*.wav', name)
  24.    file = name.vstring  
  25.    if ((file='')|(button='CANCEL')) then signal cleanup
  26. end
  27.  
  28. /* Radio Box for sampling rate selection*/
  29. if (rate = '') then do
  30.    list.0 = 4
  31.    list.1  = '8'
  32.    list.2  = '11.25'
  33.    list.3  = '22.5'
  34.    list.4  = '43.4'
  35.    list.vstring = list.3          /* default selection */
  36.    button= VRadioBox( ' Select Sampling Rate (kHz) ', list, 3)
  37.    rate = list.vstring
  38.    if button='CANCEL' then signal cleanup
  39. end
  40.  
  41. /* Zip file handling */
  42. zipflag=0
  43. if ((RIGHT(file,3) = 'ZIP') | (RIGHT(file,3)='zip')) then do
  44.    prompt.0 =4 
  45.    prompt.1 = ' You have Selected a Zip Archive! '
  46.    prompt.2 = ' '
  47.    prompt.3 = '   Please enter the filename of the '
  48.    prompt.4 = ' sound file contained in the archive. '
  49.    'unzip -v' file
  50.    button = VInputBox('Zip Archive Handler', prompt, 20, 3)
  51.    if button='CANCEL' then signal cleanup
  52.    zipflag=1
  53.    'unzip 'file  prompt.vstring
  54.    file = prompt.vstring
  55. end
  56.  
  57. /* Player Section */
  58. if ((FILESPEC("drive",file)='A:')|(FILESPEC("drive",file)='B:')) then do
  59.    'copy' file 'cplay1.wav'
  60.    'sox cplay1.wav -r'rate*1000' cplay2.wav'
  61. end
  62. else 'sox' file '-r'rate*1000' cplay2.wav'
  63. 'player -r'rate*1000' cplay2.wav' 
  64. 'erase cplay?.wav' 
  65. if zipflag=1 then 'erase 'file
  66.  
  67. /* Signal completion */
  68. 'player -r11000 %sounds%\sttng\progcomp.wav'
  69.  
  70. CLEANUP:
  71.    do
  72.       call VExit
  73.       exit
  74.    end 
  75. exit
  76.  
  77.  
  78.