home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / dmkit / flat / segue.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-03  |  1.8 KB  |  68 lines

  1. //** Demonstration program for the new MIDPAK and DIGPAK loading and
  2. //** unloading system.    Uses LOADER.C.
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. #include "midpak.h"
  7. #include "doscalls.h"
  8. #include "loader.h"
  9. #include "support.h"
  10.  
  11. void main(int argc,char **argv)
  12. {
  13.     char *song;
  14.     long int siz,songlen;
  15.     int xcon,keypress,sequence=0,SegueNumber=0;
  16.     char str[80];
  17.  
  18.     if ( LoadMidPak("MIDPAK.COM", "MIDPAK.ADV", "MIDPAK.AD" ) ) // Load MIDPAK into memory.
  19.     {
  20.         if ( InitMidPak() ) // Initialize MIDPAK driver.
  21.         {
  22.             song = floadlow("TEST.XMI", &songlen); // Load song into memory.
  23.             if ( song )
  24.             {
  25.                 RegisterXmidi(song,songlen); // register the song.
  26.                 SetRelativeVolume(100,0) ;
  27.                 PlaySequence(0); // play the song.
  28.                 printf("Have begun to play the song...\n");
  29.                 printf("Press a key '0'-'4' to 'segue' to that sequence.\n");
  30.                 xcon = 0;
  31.                 do
  32.                 {
  33.                     sequence = ReportSequenceNumber(); // Find out current sequence number.
  34.                     if ( SequenceStatus() == SEQ_PLAYING )
  35.                         sprintf(str,"Playing sequence #%d",sequence);
  36.                     else
  37.                         sprintf(str,"Sequence #%d not playing.",sequence);
  38.                     tprint(0,0,40,str,BLUE BEHIND YELLOW);
  39.                     sprintf(str,"Next segue request #%d",SegueNumber);
  40.                     tprint(0,1,40,str,BLUE BEHIND YELLOW);
  41.                     if ( keystat() )
  42.                     {
  43.                         keypress = getkey();
  44.                         switch ( keypress )
  45.                         {
  46.                             case 27: xcon = 1;
  47.                             default:
  48.                                 if ( keypress >= '0' && keypress <= '4' )
  49.                                 {
  50.                                     SegueNumber = keypress-'0';
  51.                                     SegueSequence(SegueNumber,-1);
  52.                                     if ( SequenceStatus() != SEQ_PLAYING )
  53.                                     {
  54.                                         PlaySequence(SegueNumber);
  55.                                     }
  56.                                 }
  57.                                 break;
  58.                         }
  59.                     }
  60.                 } while (!xcon);
  61.             }
  62.         }
  63.     }
  64.  
  65.     DeInitMidPak();
  66.     UnLoadMidPak();
  67. }
  68.