home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 25 / CD_ASCQ_25_1095.iso / dos / prg / dwstk200 / findsb.c < prev    next >
C/C++ Source or Header  |  1995-06-26  |  3KB  |  104 lines

  1. /******************************************************************************
  2. File:          findsb.c
  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:     Keith Weiner & Erik Lorenzen
  8. Purpose:     Example code to autodetect and print out the sound hardware
  9. History:     94/10/21 KW        Started
  10.                      95/02/01 KW/EL Finalized
  11.                      95/03/22 EL        Finalized for 1.01
  12.                      95/04/11 EL        Finalized for 1.02
  13.                      95/06/13 EL        Finalized for 1.03 (no changes)
  14.                      95/06/16 EL        Finalized for 2.00 (no changes)
  15. ******************************************************************************/
  16.  
  17.  
  18.  
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21.  
  22. #include "dws.h"
  23. #include "err.h"
  24.  
  25.  
  26.  
  27. void main(void)
  28. {
  29.     dws_DETECTOVERRIDES dov;
  30.     dws_DETECTRESULTS     dres;
  31.  
  32.     printf("\nFINDSB 2.00 is Copyright 1994-95 DiamondWare, Ltd.\n");
  33.     printf("All rights reserved.\n\n\n");
  34.  
  35.     /*
  36.      . We need to set every field to -1 in dws_DETECTOVERRIDES struct;
  37.      . this tells the STK to autodetect everything.  Any other value
  38.      . overrides the autodetect routine, and will be accepted on
  39.      . faith, though the STK will verify it if possible.
  40.     */
  41.     dov.baseport = (word)-1;
  42.     dov.digdma     = (word)-1;
  43.     dov.digirq     = (word)-1;
  44.  
  45.     if (!dws_DetectHardWare(&dov, &dres))
  46.     {
  47.         err_Display(dws_ErrNo());
  48.         exit(-1);
  49.     }
  50.  
  51.     /* Test for FM or DIG */
  52.     if ((dres.capability & dws_capability_FM) ||
  53.             ((dres.baseport != 0x388) && (dres.baseport != (word)-1)))
  54.     {
  55.         printf("Base port is %x hex.\n\n", dres.baseport);
  56.  
  57.         if (dres.mixtyp > 1)
  58.         {
  59.             printf("The sound hardware supports mixing.\n\n");
  60.         }
  61.         else
  62.         {
  63.             printf("Mixing will be done in software.\n\n");
  64.         }
  65.  
  66.         if (dres.capability & dws_capability_FM)
  67.         {
  68.             printf("The sound hardware supports FM music playback.\n\n");
  69.         }
  70.         else
  71.         {
  72.             printf("Support for FM music playback not found.\n\n");
  73.         }
  74.  
  75.         if (dres.capability & dws_capability_DIG)
  76.         {
  77.             /* If we got here dws_DetectHardWare got PORT, IRQ, & DMA */
  78.             printf("The sound hardware supports digitized sound playback.\n\n");
  79.             printf("The sound hardware uses DMA channel %d and IRQ level %d.\n\n",
  80.                          dres.digdma, dres.digirq);
  81.         }
  82.         else if ((dres.baseport != 0x388) && (dres.baseport != (word)-1))
  83.         {
  84.             /*
  85.              . If dres.baseport isn't either 388hex, or -1, then it's a valid
  86.              . baseport.    So if we got here, then we didn't find either IRQ
  87.              . level, and/or DMA channel.  In order to play digitized sounds,
  88.              . we need these settings as well.    In your application, you should
  89.              . ask the user.
  90.             */
  91.             printf("The sound hardware supports digitized sound playback,\n");
  92.             printf("but we couldn't find the DMA channel and/or IRQ level.\n\n");
  93.         }
  94.         else
  95.         {
  96.             printf("Support for digitized playback not found.\n\n");
  97.         }
  98.     }
  99.     else
  100.     {
  101.         printf("No sound hardware detected.\n\n");
  102.     }
  103. }
  104.