home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1996 January / SOFM_Jan1996.bin / pc / os2 / pmpost / playchim.cmd < prev    next >
OS/2 REXX Batch file  |  1995-12-05  |  2KB  |  56 lines

  1. /* Chime player for PM PostNotes        */
  2. /*                                      */
  3. /* Adapted from example in mcirexx.inf  */ 
  4. /* This .cmd file is called from within */
  5. /* PM PostNotes                         */
  6.  
  7. /* Load and initialize Multimedia REXX support */
  8. call RXFUNCADD 'mciRxInit','MCIAPI','mciRxInit'
  9. call mciRxInit
  10.  
  11. /* Parse arguments - repeat [wave] [count] times */
  12. parse arg count wave .
  13.  
  14. /* Open the default digital audio device for exclusive use */
  15. rc = mciRxSendString('open waveaudio alias wave wait', 'RetStr', '0', '0')
  16.  
  17. /* Check for an error, exit */
  18. if rc <> 0 then
  19.    signal error
  20.  
  21.  
  22. /* Load [wave] file */
  23. rc = mciRxSendString('load wave '||wave||' wait', 'RetStr', '0', '0')
  24.  
  25. /* Set the time format to milliseconds */
  26. call mciRxSendString 'set wave time format ms', 'RetStr', '0', '0'
  27.  
  28. /* play wave [count] times */
  29. do count
  30.    /* Play the multimedia file, wait for completion */
  31.    call mciRxSendString 'play wave wait', 'RetStr', '0', '0'
  32.  
  33.    /* "Rewind" to the beginning of the file */
  34.    call mciRxSendString 'seek wave to start wait', 'RetStr', '0', '0'
  35.  
  36.    /* Add a timer to pause a 1/2 second */
  37.    call TIME 'R'
  38.    rc = TIME('E')
  39.    do until rc = .5
  40.       rc = TIME('E')
  41.       if rc > .5 then
  42.          rc = .5
  43.    end
  44. end
  45.  
  46. /* Close the device context */
  47. call mciRxSendString 'close wave', 'RetStr', '0', '0'
  48.  
  49. /* Ensure proper termination of Multimedia REXX */
  50. call mciRxExit
  51.  
  52. exit(0)
  53.    
  54. error:
  55. call mciRxExit
  56. exit(1)