home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 25 / CD_ASCQ_25_1095.iso / dos / prg / dwstk200 / findsb.bas < prev    next >
BASIC Source File  |  1995-06-26  |  3KB  |  99 lines

  1. '******************************************************************************
  2. 'File:      findsb.bas
  3. 'Version:   2.00
  4. 'Tab stops: every 2 columns
  5. 'Project:   FINDSB utility
  6. 'Copyright: 1994-1995 DiamondWare, Ltd.  All rights reserved.
  7. 'Written:   Erik Lorenzen & Don Lemons
  8. 'Purpose:   Example code to autodetect and print out the sound hardware
  9. 'History:   94/10/21 KW Started findsb.c
  10. '           94/11/12 DL translated to BASIC
  11. '           95/02/02 EL Cleaned up & Finalized
  12. '           95/03/22 EL Finalized for 1.01
  13. '           95/04/11 EL Finalized for 1.02
  14. '           95/06/06 EL Finalized for 1.03 (no changes)
  15. '           95/06/06 EL Finalized for 2.00 (no changes)
  16. '******************************************************************************
  17.  
  18.  
  19.  
  20. '$INCLUDE: 'dws.bi'
  21. '$INCLUDE: 'err.bi'
  22.  
  23.  
  24.  
  25. 'DECLARE VARIABLES
  26.     COMMON SHARED dov     AS dwsDETECTOVERRIDES
  27.     COMMON SHARED dres    AS dwsDETECTRESULTS
  28.     COMMON SHARED ideal AS dwsIDEAL
  29.  
  30.  
  31.  
  32. 'START OF MAIN
  33.  
  34.     PRINT
  35.     PRINT "FINDSB 2.00 is Copyright 1994-95, DiamondWare, Ltd."
  36.     PRINT "All rights reserved."
  37.     PRINT : PRINT : PRINT
  38.  
  39.     'We need to set every field to -1 in dws_DETECTOVERRIDES struct; this
  40.     'tells the STK to autodetect everything.  Any other value
  41.     'overrides the autodetect routine, and will be accepted on
  42.     'faith, though the STK will verify it if possible.
  43.  
  44.     dov.baseport = -1
  45.     dov.digdma     = -1
  46.     dov.digirq     = -1
  47.  
  48.     IF dwsDetectHardWare(dov, dres) = 0 THEN
  49.         errDisplay
  50.     END IF
  51.  
  52.     'Test for FM or DIG
  53.     IF ((dres.capability AND dwscapabilityFM) OR ((dres.baseport <> 904) AND (dres.baseport <> -1))) THEN
  54.  
  55.         PRINT "Base port is ";HEX$(dres.baseport);" hex."
  56.         PRINT
  57.  
  58.         IF dres.mixtyp > 1 THEN
  59.             PRINT "The sound hardware supports mixing."
  60.             PRINT
  61.         ELSE
  62.             PRINT "Mixing will be done in software."
  63.             PRINT
  64.         ENDIF
  65.  
  66.         IF (dres.capability AND dwscapabilityFM) = dwscapabilityFM THEN
  67.             PRINT "The sound hardware supports FM music playback."
  68.             PRINT
  69.         ELSE
  70.             PRINT "Support for FM music playback not found."
  71.             PRINT
  72.         ENDIF
  73.  
  74.         IF (dres.capability AND dwscapabilityDIG) = dwscapabilityDIG THEN
  75.             'If we got here dws_DetectHardWare got PORT, IRQ, & DMA
  76.             PRINT "The sound hardware supports digitized sound playback."
  77.             PRINT "The sound hardware uses DMA channel";dres.digdma;"and IRQ level";dres.digirq;"."
  78.             PRINT
  79.         ELSEIF ((dres.baseport <> 904) AND (dres.baseport <> -1)) THEN
  80.             'If dres.baseport isn't either 388hex, or -1, then it's a valid
  81.             'baseport.  So if we got here, then we didn't find either IRQ
  82.             'level, and/or DMA channel.  In order to play digitized sounds,
  83.             'we need these settings as well.  In your application, you should
  84.             'ask the user.
  85.             PRINT "The sound hardware supports digitized sound playback,"
  86.             PRINT "but we couldn't find the DMA channel and/or IRQ level."
  87.             PRINT
  88.         ELSE
  89.             PRINT "Support for digitized playback not found."
  90.             PRINT
  91.         END IF
  92.  
  93.     ELSE
  94.         PRINT "No sound hardware detected."
  95.         PRINT
  96.     ENDIF
  97.  
  98. END
  99.