home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / vrac / pbwiz21.zip / PLAYVOC.BAS < prev    next >
BASIC Source File  |  1994-04-10  |  3KB  |  81 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |         PBWIZ  Copyright (c) 1991-1994  Thomas G. Hanlin III         |
  4. '   |                      3544 E. Southern Ave. #104                      |
  5. '   |                            Mesa, AZ 85204                            |
  6. '   |                                                                      |
  7. '   |                      PowerBASIC Wizard's Library                     |
  8. '   |                                                                      |
  9. '   +----------------------------------------------------------------------+
  10.  
  11. ' This is another simple demo of the PBWiz routines.  It allows you to play
  12. ' a digitized sound file (.VOC format) on a SoundBlaster.  The SBSIM driver,
  13. ' which is provided with the SoundBlaster, is required.
  14.  
  15. ' Syntax:
  16. '   PLAYVOC vocname[.VOC]
  17.  
  18. ' The file extension is optional.
  19.  
  20.    DECLARE SUB SBGetActive (INTEGER, INTEGER, INTEGER, INTEGER, INTEGER)
  21.    DECLARE FUNCTION SBInt% ()
  22.    DECLARE SUB SBInitSrcFile (BYVAL INTEGER, STRING, INTEGER)
  23.    DECLARE SUB SBPlay (BYVAL INTEGER)
  24.    DECLARE SUB SBStop (BYVAL INTEGER)
  25.  
  26.    $LINK "pbwiz.pbl"
  27.  
  28.    DEFINT A-Z
  29.  
  30.  
  31.  
  32.    '--- Pluck filename from command line.
  33.    File$ = LTRIM$(RTRIM$(UCASE$(COMMAND$)))
  34.  
  35.    '--- If they didn't enter a filename, let's tell 'em about ourselves.
  36.    IF ((LEN(File$) = 0) OR (INSTR(File$, "/?") > 0)) THEN
  37.       PRINT "PLAYVOC: Digitized Sound Player for PBWiz by Thomas G. Hanlin III"
  38.       PRINT
  39.       PRINT "Syntax:"
  40.       PRINT "  PLAYVOC vocname[.VOC]
  41.       PRINT
  42.       PRINT "The file extension is optional and defaults to .VOC.  This demo plays .VOC"
  43.       PRINT "digitized sound files on a SoundBlaster, using the SBSIM driver."
  44.       END
  45.    END IF
  46.  
  47.    '--- Add .VOC extension if they didn't provide it.
  48.    IF (INSTR(File$, ".") = 0) THEN File$ = File$ + ".VOC"
  49.  
  50.    '--- Check the SBSIM interrupt to make sure SBSIM is installed.
  51.    IF (SBInt = 0) THEN
  52.       PRINT "PLAYVOC requires the SBSIM driver to function.  SBSIM is provided with the"
  53.       PRINT "SoundBlaster.  Go to your SoundBlaster directory and type SBSIM to install"
  54.       PRINT "the driver before using PLAYVOC.  You will probably get some extraneous error"
  55.       PRINT "messages from SBSIM-- ignore them.  PLAYVOC will tell you of any problem."
  56.       END
  57.    END IF
  58.  
  59.    '--- This is the number of the Disk Voice driver used for .VOC playing.
  60.    DriverNr = 2
  61.  
  62.    '--- Here we initialize Disk Voice handling for our .VOC file.
  63.    SBInitSrcFile DriverNr, File$, ErrCode
  64.    IF ErrCode THEN
  65.       PRINT "Error initializing "; File$; " for input.  Error code ="; ErrCode
  66.       END
  67.    END IF
  68.  
  69.    '--- This starts the .VOC file playing
  70.    SBPlay DriverNr
  71.  
  72.    '--- The file plays in the background, so we could do something here.
  73.    '--- In this case, though, we'll just wait for the file to finish.
  74.    '--- We'll exit if <ESC> is pressed, in case they want out.
  75.    DO
  76.       SBGetActive FM, DskVoice, MemVoice, Auxiliary, MIDI
  77.    LOOP UNTIL ((DskVoice = 0) OR (INKEY$ = CHR$(27)))
  78.  
  79.    '--- When we're done, we shut down the Disk Voice driver.
  80.    SBStop DriverNr
  81.