home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rexxalgo.zip / TESTALGO / PlayFile.CMD < prev    next >
OS/2 REXX Batch file  |  1997-08-25  |  3KB  |  100 lines

  1. /* REXX **********************************************/
  2. /*                                                   */
  3. /* Name.......: BiSearch.CMD                         */
  4. /* Function...: Test Rexx algorithms for the Binary  */
  5. /*              search                               */
  6. /*                                                   */
  7. /* Author.....: Janosch R. Kowalczyk                 */
  8. /*              Compuserve: 101572,2160              */
  9. /*                                                   */
  10. /* Create date: 26 May 1996                          */
  11. /* Version....: 1.0                                  */
  12. /*                                                   */
  13. /* Changes....: No                                   */
  14. /*                                                   */
  15. /* Notes......: Start this file with PMREXX to see   */
  16. /*              the output lines.                    */
  17. /*                                                   */
  18. /* Made use of GREED.  26 May 1996 / 12:29:24   JRK  */
  19. /*****************************************************/
  20. Arg Sound_File
  21.  
  22. /*===============(Exception handling)================*/
  23. Signal On Failure Name CLEARUP
  24. Signal On Halt    Name CLEARUP
  25. Signal On Syntax  Name CLEARUP
  26.  
  27. Say 
  28. Say Center( "( PLAY DIGITAL FILE )", 80, '*')
  29.  
  30. /* Adjust following file name */
  31. If Sound_File = '' Then
  32.   Sound_File = 'C:\MMOS2\SOUNDS\STARTUP.WAV'
  33. Say 
  34. Say 'Sound file:' Sound_File 'is played. Please wait for the end.'
  35.  
  36. rc = PlayFile(Sound_File)
  37. Call mciRxExit
  38.  
  39. Say
  40. Call LineOut , "Press any key to exit "
  41. Call LineIn
  42.  
  43. Exit
  44.  
  45. CLEARUP:
  46.   Say
  47.   Say 'GREED001E - Break, Failure or Syntax Error'
  48.   Call mciRxExit
  49. Exit
  50.  
  51.  
  52.  
  53. /*===============(Internal subroutines)===============*/
  54.  
  55. /*================(Play digital file)================*/
  56. /* :-)                                OS/2 Only!!! 7 */
  57. /* Name.......: PlayFile                             */
  58. /*                                                   */
  59. /* Function...: Play digital WAV/MID file            */
  60. /*                                                   */
  61. /* Call parms.: File name to play                    */
  62. /* Returns....: RC from the last mciRexx function    */
  63. /*                                                   */
  64. /* Sample call: rc = PlayFile('bach.mid')            */
  65. /*                                                   */
  66. /* Changes....: No                                   */
  67. /*                                                   */
  68. /* Author.....: Janosch R. Kowalczyk                 */
  69. /*===================================================*/
  70. PlayFile: Procedure
  71.  
  72. Arg CmdObject
  73. If CmdObject = '' Then Return -1
  74.  
  75. /*-----------(Initialize mciREXX support)-----------*/
  76. If RxFuncQuery( 'mciRxInit' ) Then Do
  77.   rc = RxFuncAdd( 'mciRxInit', 'MCIAPI', 'mciRxInit' )
  78.   Init_RC = mciRxInit()
  79. End
  80.  
  81. loudness = 70 /* % */
  82. /*--------------(Prepare MCI-commands)---------------*/
  83. CmdStr.1 = 'OPEN' CmdObject 'ALIAS W WAIT'
  84. CmdStr.2 = 'SET W TIME FORMAT MS WAIT'
  85. CmdStr.3 = 'SET W AUDIO VOLUME' loudness 'WAIT'
  86. CmdStr.4 = 'PLAY W WAIT'
  87. /*------------(Play digital WAV/MID file)------------*/
  88. Do i = 1 To 4
  89.   /*-----------(Send MCI command strings)------------*/
  90.   rc = mciRxSendString(CmdStr.i, 'retstrvar', '0','0')
  91.   If rc > 0 Then Leave
  92. End
  93.  
  94. CmdStr = 'CLOSE W WAIT'
  95. /*--------------(Send MCI command string)--------------*/
  96. rc = mciRxSendString(CmdStr, 'retstrvar', '0','0')
  97.  
  98. Return rc
  99.  
  100.