home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / g / gusunit.zip / GUSUNIT.PAS < prev    next >
Pascal/Delphi Source File  |  1993-02-25  |  4KB  |  129 lines

  1. Unit  GUSUnit ;
  2.  
  3. {---------------------------------------------------------------------------
  4.  
  5.    Copyright (c) 1993 by TBH-Softworx
  6.                  Oliver Fromme, Klingestr. 2, 3380 Goslar, Germany
  7.                  Internet email:   inof@asterix.rz.tu-clausthal.de
  8.  
  9.    This is donated to the PUBLIC DOMAIN.
  10.  
  11.    Many many thanks to Tran of Renaissance and Joshua Jensen!
  12.    This would be impossible without their tech specs.
  13.  
  14.    Enjoy!
  15.  
  16. ---------------------------------------------------------------------------}
  17. Interface
  18.  
  19. Const  Left   = 0 ;     {Used for VoiceBalance}
  20.        Middle = 7 ;
  21.        Right  = 15 ;
  22.  
  23.        Bit8  = 0 ;      {Used for VoiceMode and RampMode,}
  24.        Bit16 = 4 ;      {e.g. VoiceMode (0,Bit8+LoopOn+UniDir+Forw)}
  25.        LoopOff = 0 ;
  26.        LoopOn  = 8 ;
  27.        UniDir = 0 ;
  28.        BiDir  = 16 ;
  29.        Forw  = 0 ;
  30.        Backw = 64 ;
  31.        Up   = 0 ;
  32.        Down = 64 ;
  33.  
  34.  
  35. Var  GUSBase    : Word ;
  36.      GUSEnv     : String[20] ;
  37.      GUSPresent : Boolean ;
  38.      GUSMemory  : Word ;
  39.      MaxVoices  : Byte ;
  40.  
  41. Procedure  GUSInitialize ;
  42. Function   GUSTest (PortAdr : Word) : Boolean ;
  43. Procedure  GUSInit (VoicesMax : Byte) ;
  44. Function   GUSMem : Word ;
  45.  
  46. Procedure  GUSPoke (Address : LongInt ; Value : ShortInt) ;
  47. Procedure  GUSPokeW (Address : LongInt ; Value : Integer) ;
  48. Function   GUSPeek (Address : LongInt) : ShortInt ;
  49. Function   GUSPeekW (Address : LongInt) : Integer ;
  50.  
  51. Procedure  VoiceBalance (Voice : Byte ; Balance : Byte) ;
  52. Procedure  VoiceVolume (Voice : Byte ; Volume : Word) ;
  53. Procedure  VoiceFreq (Voice : Byte ; Freq : Word) ;
  54. Procedure  VoiceStart (Voice : Byte) ;
  55. Procedure  VoiceStop (Voice : Byte) ;
  56. Procedure  VoiceMode (Voice : Byte ; Mode : Byte) ;
  57.  
  58. Procedure  VoiceSample (Voice : Byte ; Start,LoopStart,LoopEnd : LongInt) ;
  59. Function   GetVoiceLoc (Voice : Byte) : LongInt ;
  60.  
  61. Procedure  RampStart (Voice : Byte) ;
  62. Procedure  RampStop (Voice : Byte) ;
  63. Procedure  RampMode (Voice : Byte ; Mode : Byte) ;
  64. Procedure  RampRate (Voice : Byte ; Scale,Rate : Byte) ;
  65. Procedure  RampRange (Voice : Byte ; Lower,Upper : Word) ;
  66.  
  67. {--------------------------------------------------------------------------}
  68. Implementation
  69. {$L GUSUNIT.OBJ}
  70.  
  71. Uses  DOS ;
  72.  
  73. Function   GUSTest (PortAdr : Word) : Boolean ; External ;
  74. Procedure  GUSInit (VoicesMax : Byte) ; External ;
  75. Function   GUSMem : Word ; External ;
  76.  
  77. Procedure  GUSPoke (Address : LongInt ; Value : ShortInt) ; External ;
  78. Procedure  GUSPokeW (Address : LongInt ; Value : Integer) ; External ;
  79. Function   GUSPeek (Address : LongInt) : ShortInt ; External ;
  80. Function   GUSPeekW (Address : LongInt) : Integer ; External ;
  81.  
  82. Procedure  VoiceBalance (Voice : Byte ; Balance : Byte) ; External ;
  83. Procedure  VoiceVolume (Voice : Byte ; Volume : Word) ; External ;
  84. Procedure  VoiceFreq (Voice : Byte ; Freq : Word) ; External ;
  85. Procedure  VoiceStart (Voice : Byte) ; External ;
  86. Procedure  VoiceStop (Voice : Byte) ; External ;
  87. Procedure  VoiceMode (Voice : Byte ; Mode : Byte) ; External ;
  88.  
  89. Procedure  VoiceSample (Voice : Byte ; Start,LoopStart,LoopEnd : LongInt) ;
  90.                        External ;
  91. Function   GetVoiceLoc (Voice : Byte) : LongInt ; External ;
  92.  
  93. Procedure  RampStart (Voice : Byte) ; External ;
  94. Procedure  RampStop (Voice : Byte) ; External ;
  95. Procedure  RampMode (Voice : Byte ; Mode : Byte) ; External ;
  96. Procedure  RampRate (Voice : Byte ; Scale,Rate : Byte) ; External ;
  97. Procedure  RampRange (Voice : Byte ; Lower,Upper : Word) ; External ;
  98.  
  99. Procedure  GUSInitialize ;
  100.    Var  w,ec : Word ;
  101.    Begin
  102.       GUSBase := 0 ;
  103.       w := $220 ;
  104.       GUSEnv := GetEnv('ULTRASND') ;
  105.       If GUSEnv<>'' Then Begin
  106.          While (GUSEnv[1]=#32) And (Length(GUSEnv)>0) Do
  107.             Delete (GUSEnv,1,1) ;
  108.          Val ('$'+Copy(GUSEnv,1,3),w,ec) ;
  109.          If (ec<>0) Or (w<$210) Or (w>$260) Or (w And $f<>0) Then
  110.             w := $220
  111.          Else
  112.             If Not GUSTest(w) Then
  113.                w := $220
  114.       End ;
  115.       If GUSBase<>0 Then
  116.          If Not GUSTest(w) Then Begin
  117.             w := $210 ;
  118.             While (w<=$260) And Not GUSTest(w) Do
  119.                Inc (w,$10)
  120.          End ;
  121.       GUSPresent := GUSBase<>0 ;
  122.       If GUSPresent Then Begin
  123.          GUSMemory := GUSMem ;
  124.          GUSInit (16)
  125.       End
  126.    End {GUSInitialize} ;
  127.  
  128. End.
  129.