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

  1. {∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞TuC∞
  2. ┌───────────────────────────────────────────────────────────────────────────┐
  3. │EXAMPLE 7 & TGP is Copyright (c)1994,95 by Gunther Voet - aka Freaker / TuC│
  4. ├───────────────────────────────────────────────────────────────────────────┤
  5. │ Music:TGR (phew) [EXAMPLE2.MOD] and MUSTAFA EROGLU (intro) [EXAMPLE6.MOD] │
  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_7;
  11.  
  12. {This example shows you how to use the low level procedures to load a file   }
  13. {by setting the port, irq, dma and device specified by yourself. If you      }
  14. {define the wrong information the player will crash. If you want  to load a  }
  15. {new modfile, you must unload the modfile, and reload from memory.           }
  16. {Herein is also shown how to load 2 modfiles with fade out and in.           }
  17.  
  18.  
  19. {$M 4096,0,8192} {This directive is NECESSARY for the mod-load}
  20.                  {2000 bytes heap & stacksize is REQUIRED for the player}
  21.                  {4096 bytes heap / 9128 stack is RECOMMENDED}
  22.  
  23.  
  24. USES TGP,CRT; {This time no starfield :)}
  25.  
  26. var i,
  27.     xold,
  28.     yold     : byte;
  29.  
  30. Const Cardtypes : Array[1..6] of string =
  31.       ('SPEAKER',
  32.        'DAC',
  33.        'SOUNDBLASTER',
  34.        'SOUNDBLASTER / PRO',
  35.        'SOUNDBLASTER / ASP16 & AWE32',
  36.        'GUS & GUS/MAX');
  37.  
  38. begin
  39.   tgp.device:=tgp.bestcard;
  40.   tgp.musport:=tgp.info.bestcard.port;
  41.   tgp.Irq:=tgp.info.bestcard.irq;
  42.   tgp.Dma:=tgp.info.bestcard.dma;
  43.   TGP.INITPLAYER(tgp.Device,tgp.musport,tgp.Irq,tgp.Dma);
  44.  
  45.   Writeln('Device used       : ',tgp.device);
  46.   Writeln('Description       : ',cardtypes[tgp.device]);
  47.   Writeln('Port used         : $',tgp.info.bestcard.port);
  48.   Writeln('Interrupt used    : IRQ',tgp.irq);
  49.   Writeln('DMA channel used  : DMA',tgp.dma);
  50.  
  51.   Writeln;Writeln;
  52.  
  53.  
  54.   textattr:=$0F;
  55.   Writeln('Loading "EXAMPLE2.MOD"');
  56.   TGP.LOADFILE('EXAMPLE2.MOD');
  57.   textattr:=$0E;
  58.  
  59.   gotoxy(1,13);
  60.   Write('[Init     #s1] ');
  61.   TGP.INITCARD;
  62.  
  63.   gotoxy(20,13);
  64.   Write('[Volume   254] ');
  65.   TGP.VOLUME(254);
  66.  
  67.   gotoxy(40,13);
  68.   Write('[Startmus #s1] ');
  69.   TGP.STARTMUS;
  70.  
  71.   gotoxy(60,13);
  72.   Write('[Pos  #s1:(');
  73.   xold:=wherex;
  74.   yold:=wherey;
  75.   repeat                                {Start of Repeat}
  76.      gotoxy(xold,yold);
  77.      write(tgp.position(curpos),')] ');
  78.   until keypressed;                     {repeat until port $60 = 1 (faster }
  79.  
  80.  
  81.   gotoxy(1,14);
  82.   Write('[Qloc #s1:(',tgp.position(curpos),')]');
  83.  
  84.   gotoxy(20,14);
  85.   Write('[Clearkbd    ] ');
  86.   mem[0:$41A]:=mem[$0:$41C];
  87.  
  88.   gotoxy(40,14);
  89.   Write('[Fadeout  #s1:(');
  90.   xold:=wherex;
  91.   yold:=wherey;
  92.   FOR I:=64 downto 0 do
  93.       begin
  94.          delay(5);
  95.          gotoxy(xold,yold);
  96.          write(TGP.VOLUME(i),')] ');
  97.       end;
  98.  
  99.  
  100.  
  101.   gotoxy(1,17);
  102.   textattr:=$0F;
  103.   Writeln('Loading "EXAMPLE6.MOD"');
  104.   TGP.LOADFILE('EXAMPLE6.MOD');
  105.   textattr:=$0E;
  106.  
  107.   gotoxy(1,18);
  108.   Write('[Stopmus  #s1] ');
  109.   TGP.STOPMUS;
  110.   Writeln;
  111.  
  112.   gotoxy(20,18);
  113.   Write('[Init        ] ');
  114.   TGP.INITCARD;
  115.  
  116.   gotoxy(40,18);
  117.   Write('[Startmus #s2] ');
  118.   TGP.STARTMUS;
  119.  
  120.   gotoxy(60,18);
  121.   Write('[Fadein   #s2(');
  122.   xold:=wherex;
  123.   yold:=wherey;
  124.   FOR I:=0 to 254 do
  125.       begin
  126.          delay(5);
  127.          gotoxy(xold,yold);
  128.          write(TGP.VOLUME(i),')] ');
  129.      end;
  130.  
  131.   gotoxy(1,19);
  132.   Write('[Pos  #s1:(');
  133.   xold:=wherex;
  134.   yold:=wherey;
  135.   repeat
  136.     gotoxy(xold,yold);
  137.     write(tgp.position(curpos),')] ');
  138.   until keypressed;
  139.  
  140.     gotoxy(20,19);
  141.   Write('[Qloc #s2:(',tgp.position(curpos),')]');
  142.  
  143.    gotoxy(40,19);
  144.    Write('[Stop     #s2] ');
  145.    TGP.STOPMUS;
  146.  
  147.    gotoxy(60,19);
  148.    Write('[Unload   #s2]');
  149.    TGP.UNLOADMUS;
  150.  
  151.    gotoxy(1,22);
  152.    textattr:=$0B;
  153.    Writeln('Done playing example 7 ...');
  154.  
  155. end.
  156.