home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / dos / prg / dsik205 / dsik.dat / EXAMPLES / EXAMP01.C next >
C/C++ Source or Header  |  1995-04-10  |  2KB  |  56 lines

  1. /****************************************************************************
  2. *
  3. *                   Digital Sound Interface Kit (DSIK)
  4. *                            Version 2.00
  5. *
  6. *                           by Carlos Hasan
  7. *
  8. * Filename:     example1.c
  9. * Version:      Revision 1.0
  10. *
  11. * Language:     WATCOM C
  12. * Environment:  IBM PC (DOS/4GW)
  13. *
  14. * Description:  Play a music module file.
  15. *
  16. ****************************************************************************/
  17.  
  18. #include <stdio.h>
  19. #include <stdlib.h>
  20. #include <conio.h>
  21. #include "audio.h"
  22. #include "import.h"
  23.  
  24. #define MODPATH "SONG.DSM"
  25. #define MODFORM FORM_DSM
  26.  
  27. int main(void)
  28. {
  29.     SoundCard SC;
  30.     DSM *M;
  31.  
  32.     dRegisterDrivers();
  33.     if (dLoadSetup(&SC,"SETUP.CFG")) {
  34.         printf("Please run SETUP.EXE to configure.\n");
  35.         exit(EXIT_FAILURE);
  36.     }
  37.     if (dInit(&SC)) {
  38.         printf("Error initializing the sound system.\n");
  39.         exit(EXIT_FAILURE);
  40.     }
  41.     atexit((void(*)(void))dDone);
  42.     /* you can use directly dLoadModule to load DSM module files */
  43.     if (!(M = dImportModule(MODPATH,MODFORM))) {
  44.         printf("Error (%03d) loading %s module file: %s.\n",
  45.             dError, MODPATH, dErrorMsg[dError]);
  46.         exit(EXIT_FAILURE);
  47.     }
  48.     dSetupVoices(M->Header.NumTracks,M->Header.MasterVolume);
  49.     dPlayMusic(M);
  50.     printf("Playing module. Press any key to continue.\n");
  51.     while (!kbhit()) dPoll();
  52.     dStopMusic();
  53.     dFreeModule(M);
  54.     return 0;
  55. }
  56.