home *** CD-ROM | disk | FTP | other *** search
/ PSION CD 2 / PsionCDVol2.iso / Programs / 283 / Shell5SourceCode.sis / play (.txt) < prev    next >
Encoding:
EPOC OPL Source  |  1998-08-30  |  1.8 KB  |  66 lines

  1.  
  2.  
  3. Rem   play, an addon command for Shell5
  4. Rem   Play an audio file
  5. Rem
  6. Rem   Copyright (C) 1998  Nick Murray
  7. Rem
  8. Rem   This program is free software; you can redistribute it and/or
  9. Rem   modify it under the terms of the GNU General Public License
  10. Rem   as published by the Free Software Foundation; either version 2
  11. Rem   of the License, or (at your option) any later version.
  12. Rem
  13. Rem   This program is distributed in the hope that it will be useful,
  14. Rem   but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. Rem   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. Rem   See the GNU General Public License for more details.
  17. Rem
  18. Rem   You should have received a copy of the GNU General Public License
  19. Rem   along with this program; if not, write to the Free Software Foundation,
  20. Rem   Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  21. Rem
  22. INCLUDE "System.oxh"
  23. PROC play%:(n%)
  24. LOCAL buf$(255),vol%,ret%
  25.     ONERR ErrTrap::
  26.     vol%=1
  27.     IF n%>1
  28.         buf$=PEEK$(argv&(2))
  29.         IF buf$="-s"
  30.             STOPSOUND&:
  31.         ELSEIF buf$="-v" AND n%=4
  32.             vol%=VAL(PEEK$(argv&(3)))
  33.             IF vol%<0 OR vol%>3
  34.                 RAISE -7                        Rem out of range
  35.             ENDIF
  36.             buf$=PEEK$(argv&(4))
  37.             GOTO Play::
  38.         ELSEIF n%=2
  39. Play::
  40.             ret%=Fparse%:(ADDR(buf$),buf$)
  41.             IF ret% < 0
  42.                 RAISE ret%
  43.             ELSEIF ret%
  44.                 RAISE -2            Rem change this?┬áInvalid arguments
  45.             ENDIF
  46.             IF _sndstat&
  47.                 STOPSOUND&:
  48.                 IOWAITSTAT32 _sndstat&
  49.             ENDIF
  50.             PLAYSOUNDA:(buf$,vol%,_sndstat&)
  51.         ELSE
  52.             GOTO Usage::
  53.         ENDIF
  54.     ELSE
  55. Usage::
  56.         PRINT "Usage: play [-s] [-v <volume>] <filename>"
  57.     ENDIF
  58.     RETURN
  59. ErrTrap::
  60.     ONERR off
  61.     PRINT err$:(ERR)
  62.     RETURN ERR
  63. ENDP
  64.  
  65.  
  66.