home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / SOUNDS.ZIP / EXAMPLE1.CPP next >
C/C++ Source or Header  |  1994-01-02  |  3KB  |  89 lines

  1. //***************************************************************************
  2. // Stephen. A. Edwards. December 1993
  3. //
  4. // Example for use of Sounds class.
  5. //
  6. // A simple example to demonstrate the use of the Sounds class.
  7. // As the first argument to the program use the directory and filename
  8. // of a valid VOC format sound file.
  9. //
  10.  
  11. #include <stdlib.h>
  12. #include <stdio.h>
  13. #include <conio.h>
  14.  
  15. #include "sounds.h";
  16.  
  17. //**************************************************************************
  18. // main program
  19.  
  20. main(int argc, char * argv[] )
  21. {
  22. Sounds *     mysound;
  23.  
  24. enum IRQ      irq  = IRQ5;
  25. enum SIZE     size = BUF8K;
  26. enum BASE     base = BASE220;
  27.  
  28. long int    Status;
  29. char *        error;
  30. int            confirm;
  31.  
  32. clrscr();
  33. printf("Sounds Class Example Program\n\n");
  34. printf("This example assumes the following: \n");
  35. printf("  1) You have a Sound Blaster or Sound Blaster Compatible card. \n");
  36. printf("  2) This example uses IRQ5 for the sound card. \n");
  37. printf("  3) This examples assumes the base address for the card is 0x220.\n");
  38. printf("\n");
  39. printf("If your sound card does not use IRQ5 or does not have \n");
  40. printf("a Base Address of 0x220 change this program accordingly.\n");
  41. printf("Otherwise you can expect to see some error messages instead \n");
  42. printf("of hearing the sound file.\n");
  43. printf("\n");
  44. printf("Are we ready ? ( type Y or N ) ");
  45.  
  46. confirm = getch();
  47. if ( confirm == 'Y' || confirm == 'y' )
  48.     {
  49.     if ( argc > 1 )
  50.         {
  51.         mysound = new Sounds( irq, base, size);
  52.  
  53.         if( (Status = mysound->Play( argv[1] )) != 1 )
  54.             {
  55.             printf("*** Error *** Status is %li \n", Status);
  56.             mysound->Error( Status, &error );
  57.             printf("%s \n", error );
  58.             }
  59.  
  60.         while( !mysound->Finished );
  61.  
  62.         delete mysound;
  63.  
  64.         printf("\n");
  65.         printf("Finished - Later Dude \n");
  66.         }
  67.     else
  68.         {
  69.         printf("\n");
  70.         printf("I was expecting the name of a VOC format sound file. \n");
  71.         printf("Please try again with the name of a VOC file. \n");
  72.         printf("Thank You.\n");
  73.         }
  74.  
  75.     } // endif chickened out
  76. else
  77.     {
  78.     clrscr();
  79.     printf("\n\n\n");
  80.     printf("A wise decision.\n");
  81.     printf("Please modify this program to use the correct IRQ \n");
  82.     printf("and/or Base Address. Please note that registered users \n");
  83.     printf("will receive an upgraded version of this software with \n");
  84.     printf("many new useful funtions as well as the ability \n");
  85.     printf("to auto-detect the IRQ and Base Address. All for the very \n");
  86.     printf("low price of $15, what a bargain!\n\n");
  87.     printf("Have a nice day.\n");
  88.     }
  89. }