home *** CD-ROM | disk | FTP | other *** search
- Rem ****************************************
- Rem * Shell3a external command - play.opl
- Rem * ╕ Nick Murray May 1996
- Rem *
- Rem * play - Play an audio .WVE file
- Rem ****************************************
- PROC play%:(n%)
- LOCAL ret%,vol%,buf$(128),pstat%
- ONERR ErrTrap::
- Rem Check the arguments
- IF n%<2 OR n%>3
- PRINT "Usage: play <filename> [volume]"
- RETURN
- ENDIF
- Rem Check the file given and return it's full path
- ret%=Fparse%:(ADDR(buf$),PEEK$(argv%(2)))
- IF ret%<0 Rem error
- RAISE ret%
- ENDIF
- IF n%=3 Rem 2 arguments so get the volume
- vol%=EVAL(PEEK$(argv%(3)))
- ELSE
- vol%=2 Rem otherwise set the default
- ENDIF
- buf$=buf$+chr$(0)
- Rem System call to generate the sound
- CALL($1E86,UADD(ADDR(buf$),1),0,vol%,0,pstat%)
- RETURN
- ErrTrap::
- ONERR OFF
- PRINT err$:(ERR)
- ENDP
-