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

  1. ;*    TIMER.INC
  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.  
  15. ;/***************************************************************************\
  16. ;*
  17. ;* Function:     int tmrGetScrSync(ushort *scrSync);
  18. ;*
  19. ;* Description:  Calculates the screen synchronization value for timer
  20. ;*
  21. ;* Input:        ushort *scrSync         pointer to screen synchronization
  22. ;*                                       value
  23. ;*
  24. ;* Returns:      MIDAS error code.
  25. ;*               Screen syncronization value used with tmrSyncScr() is stored
  26. ;*               in *scrSync.
  27. ;*
  28. ;\***************************************************************************/
  29.  
  30. GLOBAL  LANG tmrGetScrSync : far
  31.  
  32.  
  33.  
  34.  
  35. ;/***************************************************************************\
  36. ;*
  37. ;* Function:     int tmrInit(void);
  38. ;*
  39. ;* Description:  Initializes TempoTimer.
  40. ;*
  41. ;* Returns:      MIDAS error code
  42. ;*
  43. ;\***************************************************************************/
  44.  
  45. GLOBAL  LANG tmrInit : far
  46.  
  47.  
  48.  
  49.  
  50. ;/***************************************************************************\
  51. ;*
  52. ;* Function:     int tmrClose(void);
  53. ;*
  54. ;* Description:  Uninitializes TempoTimer. MUST be called if and ONLY if
  55. ;*               tmrInit() has been called.
  56. ;*
  57. ;* Returns:      MIDAS error code
  58. ;*
  59. ;\***************************************************************************/
  60.  
  61. GLOBAL  LANG tmrClose : far
  62.  
  63.  
  64.  
  65.  
  66. ;/***************************************************************************\
  67. ;*
  68. ;* Function:     int tmrPlay(void (*play)(), SoundDevice *SD);
  69. ;*
  70. ;* Description:  Starts playing music with the timer. Update rate set to 50Hz.
  71. ;*
  72. ;* Input:        void (*play)()          Music playing function
  73. ;*               SoundDevice *SD         Sound Device used for playing
  74. ;*
  75. ;* Returns:      MIDAS error code
  76. ;*
  77. ;\***************************************************************************/
  78.  
  79. GLOBAL  LANG tmrPlay : far
  80.  
  81.  
  82.  
  83.  
  84. ;/***************************************************************************\
  85. ;*
  86. ;* Function:     int tmrStop(void);
  87. ;*
  88. ;* Description:  Stops playing music with the timer.
  89. ;*
  90. ;* Returns:      MIDAS error code
  91. ;*
  92. ;\***************************************************************************/
  93.  
  94. GLOBAL  LANG tmrStop : far
  95.  
  96.  
  97.  
  98.  
  99. ;/***************************************************************************\
  100. ;*
  101. ;* Function:     int tmrSyncScr(ushort sync, void (*preVR)(), void (*immVR)(),
  102. ;*               void (*inVR)());
  103. ;*
  104. ;* Description:  Synchronizes the timer to screen refresh.
  105. ;*
  106. ;* Input:        ushort sync             Screen synchronization value returned
  107. ;*                                       by tmrGetScrSync().
  108. ;*               void (*preVR)()         Pointer to the routine that will be
  109. ;*                                       called BEFORE Vertical Retrace
  110. ;*               void (*immVR)()         Pointer to the routine that will be
  111. ;*                                       called immediately after Vertical
  112. ;*                                       Retrace starts
  113. ;*               void (*inVR)()          Pointer to the routine that will be
  114. ;*                                       called some time during Vertical
  115. ;*                                       Retrace
  116. ;*
  117. ;* Returns:      MIDAS error code
  118. ;*
  119. ;* Notes:        preVR() and immVR() functions must be as short as possible
  120. ;*               and do nothing else than update counters or set some VGA
  121. ;*               registers to avoid timer synchronization problems. inVR()
  122. ;*               can take a longer time and can be used for, for example,
  123. ;*               setting the palette.
  124. ;*
  125. ;\***************************************************************************/
  126.  
  127. GLOBAL  LANG tmrSyncScr : far
  128.  
  129.  
  130.  
  131.  
  132. ;/***************************************************************************\
  133. ;*
  134. ;* Function:     int tmrStopScrSync(void);
  135. ;*
  136. ;* Description:  Stops synchronizing the timer to the screen.
  137. ;*
  138. ;* Returns:      MIDAS error code
  139. ;*
  140. ;\***************************************************************************/
  141.  
  142. GLOBAL  LANG tmrStopScrSync : far
  143.  
  144.  
  145.  
  146. ;/***************************************************************************\
  147. ;*
  148. ;* Function:     int tmrSetUpdRate(ushort updRate);
  149. ;*
  150. ;* Description:  Sets the timer update rate, ie. the rate at which the music
  151. ;*               playing routine is called
  152. ;*
  153. ;* Input:        ushort updRate          updating rate, in 100*Hz (5000=50Hz)
  154. ;*
  155. ;* Returns:      MIDAS error code
  156. ;*
  157. ;\***************************************************************************/
  158.  
  159. GLOBAL  LANG tmrSetUpdRate : far
  160.  
  161.  
  162.  
  163. ;/***************************************************************************\
  164. ;*       enum tmrFunctIDs
  165. ;*       ----------------
  166. ;* Description:  ID numbers for TempoTimer functions
  167. ;\***************************************************************************/
  168.  
  169. ENUM    tmrFunctIDs \
  170.         ID_tmrGetScrSync = ID_tmr, \
  171.         ID_tmrInit, \
  172.         ID_tmrClose, \
  173.         ID_tmrPlay, \
  174.         ID_tmrStop, \
  175.         ID_tmrSyncScr, \
  176.         ID_tmrStopScrSync, \
  177.         ID_tmrSetUpdRate
  178.