home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 591b.lha / OctaMED_v1.0b / Programmers / Examples / example2.c / example2.c
C/C++ Source or Header  |  1991-04-30  |  1KB  |  41 lines

  1. /* This example loads two songs, the first one is the load music of the
  2.    second song. Compile with Lattice/SAS C V5.xx */
  3.  
  4. #include <exec/types.h>
  5. #include <libraries/dos.h>
  6. #include <proto/exec.h>
  7. #include <proto/dos.h>
  8. #include "libproto.h"
  9.  
  10. void main(argc,argv)
  11. int argc;
  12. char *argv[];
  13. {
  14.     struct MMD0 *sng1,*sng2;
  15.     register struct Library *MEDPlayerBase = OpenLibrary("medplayer.library",0);
  16.     if(!MEDPlayerBase) return;
  17.     printf("---example2---\n");
  18.     if(argc < 3) {
  19.         printf("Usage: example2 <song1> <song2>\n");
  20.         return;
  21.     }
  22.     GetPlayer(0); /* If this fails, no crash. Just no music. */
  23.     printf("Loading the first song...\n");
  24.     sng1 = LoadModule(argv[1]);
  25.     PlayModule(sng1); /* start the load music */
  26.     printf("Loading the second song...\n");
  27.     sng2 = LoadModule(argv[2]);
  28.     printf("Press Ctrl-C to play next song.\n");
  29.     Wait(SIGBREAKF_CTRL_C);
  30.     DimOffPlayer(35);    /* fade out the first tune */
  31.     Delay(250);        /* wait 5 seconds for fading */
  32.     PlayModule(sng2);
  33.     printf("Press Ctrl-C to quit.\n");
  34.     Wait(SIGBREAKF_CTRL_C);
  35.     UnLoadModule(sng1); /* Even if LoadModule failed, this won't crash */
  36.     UnLoadModule(sng2);
  37.     FreePlayer();
  38.     CloseLibrary(MEDPlayerBase);
  39.     printf("Bye!!!\n");
  40. }
  41.