home *** CD-ROM | disk | FTP | other *** search
/ Groovy Bytes: Behind the Moon / groovybytes.iso / GROOVY / SND_TOOL / TUCPL13.ZIP / TGP_EXAM.ZIP / EXAMPLE5.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-07-06  |  3.9 KB  |  108 lines

  1. {∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞
  2. ┌───────────────────────────────────────────────────────────────────────────┐
  3. │EXAMPLE 5 & TGP is Copyright (c)1994,95 by Gunther Voet - aka Freaker / TuC│
  4. ├───────────────────────────────────────────────────────────────────────────┤
  5. │      Starfield:Sinecure/Optimization:Freaker/Music:Alive (by ??)          │
  6. └───────────────────────────────────────────────────────────────────────────┘
  7. ∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞}
  8.  
  9.  
  10. PROGRAM EXAMPLE_5;
  11.  
  12.  
  13. {Example by Freaker / STARFIELD by Sinecure        Copyright (c)1995 by TuC }
  14.  
  15. {This example shows you how to use the low level procedures to load a file   }
  16. {by setting the port, irq, dma and device specified by yourself. If you      }
  17. {define the wrong information the player will crash. If you want  to load a  }
  18. {new modfile, you must unload the modfile, and reload from memory.           }
  19. {With autodetect GUS or SB .                                                 }
  20.  
  21.  
  22. {$M 4096,0,8192} {This directive is NECESSARY for the mod-load}
  23.                  {2000 bytes heap & stacksize is REQUIRED for the player}
  24.                  {4096 bytes heap / 9128 stack is RECOMMENDED}
  25.  
  26.  
  27.  
  28.    {MUSIC ROUTINES}
  29.    { V }
  30. USES TGP,TUC_DEMO;
  31.             { ^ }
  32.             {EXAMPLE GFX}
  33.  
  34.  
  35. begin
  36.   tgp.readcards;                        {Read all [active] cards}
  37.  
  38.   tgp.forceall:=true;                   {Force ALL options, no errorchecking}
  39.                                         {DEBUG MODE AUTOMATICALLY DISABLED !}
  40.  
  41.   {All records are structured this way:
  42.    tgp.info.detect.device[x].present (* is device[x] present ?    >boolean *)
  43.                             .irq     (* irq port [not used with GUS] >byte *)
  44.                             .dma     (* dma port [not used with GUS] >byte *)
  45.                             .port    (* port address *)              >word *)
  46.                                                                              }
  47.  
  48.   if tgp.info.detect.device[6].PRESENT then
  49.      begin
  50.        tgp.device:=6;
  51.        tgp.musport:=tgp.info.detect.device[6].port;
  52.      end else
  53.   if tgp.info.detect.device[5].PRESENT then
  54.      begin
  55.        tgp.device:=5;
  56.        tgp.musport:=tgp.info.detect.device[5].port;
  57.        tgp.irq:=tgp.info.detect.device[5].irq;
  58.        tgp.dma:=tgp.info.detect.device[5].dma;
  59.      end else
  60.   if tgp.info.detect.device[4].PRESENT then
  61.      begin
  62.        tgp.device:=4;
  63.        tgp.musport:=tgp.info.detect.device[4].port;
  64.        tgp.irq:=tgp.info.detect.device[4].irq;
  65.        tgp.dma:=tgp.info.detect.device[4].dma;
  66.       end else
  67.   if tgp.info.detect.device[3].PRESENT then
  68.      begin
  69.        tgp.device:=3;
  70.        tgp.musport:=tgp.info.detect.device[3].port;
  71.        tgp.irq:=tgp.info.detect.device[3].irq;
  72.        tgp.dma:=tgp.info.detect.device[3].dma;
  73.       end else
  74.      begin
  75.         Writeln('No valid soundcards found !  [ no GUS or SB found ! ]');
  76.         halt;
  77.      end;
  78.  
  79.  
  80.  
  81.  
  82.   TGP.INITPLAYER(tgp.Device,tgp.musport,tgp.Irq,tgp.Dma);
  83.                                         {INITIALIZE PLAYER}
  84.  
  85.   TGP.LOADFILE('EXAMPLE5.MOD');           {LOAD FILE}
  86.  
  87.   TGP.INITCARD;                         {Initialize & reset soundcard}
  88.  
  89.   TGP.STARTMUS;                         {MUSIC! MAESTRO}
  90.  
  91.   initstars;                            {Initialize star routines}
  92.  
  93.  repeat                                 {Start of Repeat}
  94.  
  95.   {You can eventually call "TGP.POLLMUSIC" or "TGP.POLLBUFFER"
  96.    if you experience problems using TGP with interrupt dependent tasks.}
  97.  
  98.   plotstars;                            {plotstars by sinecure !}
  99.  
  100.  until port[$60]=1;                     {repeat until port $60 = 1 (faster }
  101.                                         {than keypressed}
  102.  
  103.    TGP.STOPMUS;
  104.    TGP.UNLOADMUS;                       {ALWAYS uninitialize !!!!!!!}
  105.  
  106.    uninit_demounit;                     {mode 3h (textmode) and endtext !}
  107. end.
  108.