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

  1. {*      VU.PAS
  2.  *
  3.  * Real VU meter routines
  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. unit VU;
  16.  
  17.  
  18. interface
  19.  
  20.  
  21.  
  22. {****************************************************************************\
  23. *       struct vuInstrument
  24. *       -------------------
  25. * Description:  VU-meter internal instrument structure
  26. \****************************************************************************}
  27.  
  28. type
  29.     vuInstrument = Record
  30.         vuInfo : ^byte;                 { pointer to VU information or NULL }
  31.         slength : word;                 { sample length }
  32.         loopStart : word;               { sample loop start }
  33.         loopEnd : word;                 { sample loop end or 0 if no looping }
  34.     end;
  35.  
  36.     Pword = ^word;
  37.  
  38.  
  39.  
  40.  
  41. {****************************************************************************\
  42. *
  43. * Function:     vuInit : integer;
  44. *
  45. * Description:  Initializes VU-meters, allocating room for MAXINSTS
  46. *               instruments.
  47. *
  48. * Returns:      MIDAS error code
  49. *
  50. \****************************************************************************}
  51.  
  52. function vuInit : integer;
  53.  
  54.  
  55.  
  56. {****************************************************************************\
  57. *
  58. * Function:     vuClose : integer;
  59. *
  60. * Description:  Uninitializes VU-meters
  61. *
  62. * Returns:      MIDAS error code
  63. *
  64. \****************************************************************************}
  65.  
  66. function vuClose : integer;
  67.  
  68.  
  69.  
  70. {****************************************************************************\
  71. *
  72. * Function:     vuPrepare(inst : word; sample : pointer; slength, loopStart,
  73. *                   loopEnd : word): integer;
  74. *
  75. * Description:  Prepares the VU information for an instrument
  76. *
  77. * Input:        inst : word             instrument number
  78. *               sample : pointer        pointer to sample data
  79. *               slength : word          sample length
  80. *               loopStart : word        sample loop start
  81. *               loopEnd : word          sample loop end (0 if no looping)
  82. *
  83. * Returns:      MIDAS error code
  84. *
  85. \****************************************************************************}
  86.  
  87. function vuPrepare(inst : word; sample : pointer; slength, loopStart,
  88.     loopEnd : word): integer;
  89.  
  90.  
  91.  
  92. {****************************************************************************\
  93. *
  94. * Function:     vuRemove(inst : word) : integer;
  95. *
  96. * Description:  Removes and deallocates the VU information for an instrument
  97. *
  98. * Input:        inst : word             instrument number
  99. *
  100. * Returns:      MIDAS error code
  101. *
  102. \****************************************************************************}
  103.  
  104. function vuRemove(inst : word) : integer;
  105.  
  106.  
  107.  
  108.  
  109. {****************************************************************************\
  110. *
  111. * Function:     function vuMeter(inst : word; rate : longint; pos, volume : word,
  112. *                   meter : Pword) : integer;
  113. *
  114. * Description:  Calculates the VU-meter value (0-64) for the next 1/50th of
  115. *               a second
  116. *
  117. * Input:        inst : word             instrument that is played
  118. *               rate : longint          playing rate
  119. *               pos : word              sample playing position
  120. *               volume : word           playing volume (0-64)
  121. *               meter : Pword           pointer to VU-meter value
  122. *
  123. * Returns:      MIDAS error code.
  124. *               VU-meter value (0-64) is stored in meter^
  125. *
  126. \****************************************************************************}
  127.  
  128. function vuMeter(inst : word; rate : longint; pos, volume : word;
  129.     meter : Pword) : integer;
  130.  
  131.  
  132.  
  133. implementation
  134.  
  135.  
  136. USES Errors, mMem;
  137.  
  138.  
  139. function vuInit : integer; external;
  140. function vuClose : integer; external;
  141. function vuPrepare(inst : word; sample : pointer; slength, loopStart,
  142.     loopEnd : word): integer; external;
  143. function vuRemove(inst : word) : integer; external;
  144. function vuMeter(inst : word; rate : longint; pos, volume : word;
  145.     meter : Pword) : integer; external;
  146. {$L VU.OBJ}
  147.  
  148.  
  149.  
  150. END.
  151.