home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / midas / timer.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-06  |  6KB  |  192 lines

  1. {*      TIMER.PAS
  2.  *
  3.  * TempoTimer, v1.10
  4.  *
  5.  * Copyright 1994 Petteri Kangaslampi and Jarno Paananen
  6.  *
  7.  * This file is part of the MIDAS Sound System, and may only be
  8.  * used, modified and distributed under the terms of the MIDAS
  9.  * Sound System license, LICENSE.TXT. By continuing to use,
  10.  * modify or distribute this file you indicate that you have
  11.  * read the license and understand and accept it fully.
  12. *}
  13.  
  14. unit Timer;
  15.  
  16.  
  17. interface
  18.  
  19.  
  20. type
  21.     Pword = ^word;
  22.  
  23.  
  24.  
  25. {****************************************************************************\
  26. *
  27. * Function:     tmrGetScrSync(scrSync : Pword) : integer;
  28. *
  29. * Description:  Calculates the screen synchronization value for timer
  30. *
  31. * Input:        scrSync : Pword         pointer to screen synchronization
  32. *                                       value
  33. *
  34. * Returns:      MIDAS error code.
  35. *               Screen syncronization value used with tmrSyncScr() is stored
  36. *               in scrSync^.
  37. *
  38. \****************************************************************************}
  39.  
  40. function tmrGetScrSync(scrSync : Pword) : integer;
  41.  
  42.  
  43.  
  44.  
  45. {****************************************************************************\
  46. *
  47. * Function:     tmrInit : integer;
  48. *
  49. * Description:  Initializes TempoTimer.
  50. *
  51. * Returns:      MIDAS error code
  52. *
  53. \****************************************************************************}
  54.  
  55. function tmrInit : integer;
  56.  
  57.  
  58.  
  59.  
  60. {****************************************************************************\
  61. *
  62. * Function:     tmrClose : integer
  63. *
  64. * Description:  Uninitializes TempoTimer. MUST be called if and ONLY if
  65. *               tmrInit() has been called.
  66. *
  67. * Returns:      MIDAS error code
  68. *
  69. \****************************************************************************}
  70.  
  71. function tmrClose : integer;
  72.  
  73.  
  74.  
  75.  
  76. {****************************************************************************\
  77. *
  78. * Function:     tmrPlay(play : pointer; SD : pointer) : integer;
  79. *
  80. * Description:  Starts playing music with the timer. Update rate set to 50Hz.
  81. *
  82. * Input:        play : pointer      Music playing function
  83. *               SD : pointer        Sound Device used for playing
  84. *
  85. * Returns:      MIDAS error code
  86. *
  87. \****************************************************************************}
  88.  
  89. function tmrPlay(play : pointer; SD : pointer) : integer;
  90.  
  91.  
  92.  
  93.  
  94. {****************************************************************************\
  95. *
  96. * Function:     tmrStop : integer
  97. *
  98. * Description:  Stops playing a module.
  99. *
  100. * Returns:      MIDAS error code
  101. *
  102. \****************************************************************************}
  103.  
  104. function tmrStop : integer;
  105.  
  106.  
  107.  
  108.  
  109. {****************************************************************************\
  110. *
  111. * Function:     tmrSyncScr(sync : word; preVR, immVR, inVR : pointer) :
  112. *                   integer;
  113. *
  114. * Description:  Synchronizes the timer to screen refresh.
  115. *
  116. * Input:        sync : word             Screen synchronization value returned
  117. *                                       by tmrGetScrSync().
  118. *               preVR : pointer         Pointer to the routine that will be
  119. *                                       called BEFORE Vertical Retrace
  120. *               immVR : pointer         Pointer to the routine that will be
  121. *                                       called immediately after Vertical
  122. *                                       Retrace starts
  123. *               inVR : pointer          Pointer to the routine that will be
  124. *                                       called some time during Vertical
  125. *                                       Retrace
  126. *
  127. * Returns:      MIDAS error code
  128. *
  129. * Notes:        preVR() and immVR() functions must be as short as possible
  130. *               and do nothing else than update counters or set some VGA
  131. *               registers to avoid timer synchronization problems. inVR()
  132. *               can take a longer time and can be used for, for example,
  133. *               setting the palette.
  134. *
  135. \****************************************************************************}
  136.  
  137. function tmrSyncScr(sync : word; preVR, immVR, inVR : pointer) : integer;
  138.  
  139.  
  140.  
  141.  
  142. {****************************************************************************\
  143. *
  144. * Function:     tmrStopScrSync : integer;
  145. *
  146. * Description:  Stops synchronizing the timer to the screen.
  147. *
  148. * Returns:      MIDAS error code
  149. *
  150. \****************************************************************************}
  151.  
  152. function tmrStopScrSync : integer;
  153.  
  154.  
  155.  
  156. {****************************************************************************\
  157. *
  158. * Function:     tmrSetUpdRate(updRate : word) : integer;
  159. *
  160. * Description:  Sets the timer update rate, ie. the rate at which the module
  161. *               playing routine is called
  162. *
  163. * Input:        updRate : word          updating rate, in 100*Hz (5000=50Hz)
  164. *
  165. * Returns:      MIDAS error code
  166. *
  167. \****************************************************************************}
  168.  
  169. function tmrSetUpdRate(updRate : word) : integer;
  170.  
  171.  
  172.  
  173. implementation
  174.  
  175. uses  Errors, mGlobals, EMS, DMA, DSM;
  176.  
  177.  
  178.  
  179. function tmrGetScrSync(scrSync : Pword) : integer; external;
  180. function tmrInit : integer; external;
  181. function tmrClose : integer; external;
  182. function tmrPlay(play : pointer; SD : pointer) : integer; external;
  183. function tmrStop : integer; external;
  184. function tmrSyncScr(sync : word; preVR, immVR, inVR : pointer) : integer;
  185.     external;
  186. function tmrStopScrSync : integer; external;
  187. function tmrSetUpdRate(updRate : word) : integer; external;
  188. {$L TIMER.OBJ}
  189.  
  190.  
  191. END.
  192.