home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / midas / vu.h < prev    next >
C/C++ Source or Header  |  1994-08-06  |  4KB  |  155 lines

  1. /*      VU.H
  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. #ifndef __VU_H
  15. #define __VU_H
  16.  
  17.  
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21.  
  22.  
  23. /****************************************************************************\
  24. *       struct vuInstrument
  25. *       -------------------
  26. * Description:  VU-meter internal instrument structure
  27. \****************************************************************************/
  28.  
  29. typedef struct
  30. {
  31.     uchar       *vuInfo;                /* pointer to VU information or NULL*/
  32.     ushort      slength;                /* sample length */
  33.     ushort      loopStart;              /* sample loop start */
  34.     ushort      loopEnd;                /* sample loop end or 0 if no
  35.                                            looping */
  36. } vuInstrument;
  37.  
  38.  
  39.  
  40.  
  41. /****************************************************************************\
  42. *
  43. * Function:     int vuInit(void);
  44. *
  45. * Description:  Initializes VU-meters, allocating room for MAXINSTS
  46. *               instruments.
  47. *
  48. * Returns:      MIDAS error code
  49. *
  50. \****************************************************************************/
  51.  
  52. int CALLING vuInit(void);
  53.  
  54.  
  55.  
  56. /****************************************************************************\
  57. *
  58. * Function:     int vuClose(void);
  59. *
  60. * Description:  Uninitializes VU-meters
  61. *
  62. * Returns:      MIDAS error code
  63. *
  64. \****************************************************************************/
  65.  
  66. int CALLING vuClose(void);
  67.  
  68.  
  69.  
  70. /****************************************************************************\
  71. *
  72. * Function:     int vuPrepare(ushort inst, uchar *sample, ushort slength,
  73. *                             ushort loopStart, ushort loopEnd
  74. *
  75. * Description:  Prepares the VU information for an instrument
  76. *
  77. * Input:        ushort inst             instrument number
  78. *               uchar *sample           pointer to sample data
  79. *               ushort slength          sample length
  80. *               ushort loopStart        sample loop start
  81. *               ushort loopEnd          sample loop end (0 if no looping)
  82. *
  83. * Returns:      MIDAS error code
  84. *
  85. \****************************************************************************/
  86.  
  87. int CALLING vuPrepare(ushort inst, uchar *sample, ushort slength,
  88.     ushort loopStart, ushort loopEnd);
  89.  
  90.  
  91.  
  92. /****************************************************************************\
  93. *
  94. * Function:     int vuRemove(ushort inst);
  95. *
  96. * Description:  Removes and deallocates the VU information for an instrument
  97. *
  98. * Input:        ushort inst             instrument number
  99. *
  100. * Returns:      MIDAS error code
  101. *
  102. \****************************************************************************/
  103.  
  104. int CALLING vuRemove(ushort inst);
  105.  
  106.  
  107.  
  108.  
  109. /****************************************************************************\
  110. *
  111. * Function:     int vuMeter(ushort inst, ulong rate, ushort pos,
  112. *                           ushort volume, ushort *meter);
  113. *
  114. * Description:  Calculates the VU-meter value (0-64) for the next 1/50th of
  115. *               a second
  116. *
  117. * Input:        ushort inst             instrument that is played
  118. *               ulong rate              playing rate
  119. *               ushort pos              sample playing position
  120. *               ushort volume           playing volume (0-64)
  121. *               ushort *meter           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. int CALLING vuMeter(ushort inst, ulong rate, ushort pos, ushort volume,
  129.     ushort *meter);
  130.  
  131.  
  132. #ifdef __cplusplus
  133. }
  134. #endif
  135.  
  136.  
  137.  
  138. /****************************************************************************\
  139. *       enum vuFunctIDs
  140. *       ---------------
  141. * Description:  ID numbers for real VU-meter functions
  142. \****************************************************************************/
  143.  
  144. enum vuFunctIDs
  145. {
  146.     ID_vuInit = ID_vu,
  147.     ID_vuClose,
  148.     ID_vuPrepare,
  149.     ID_vuRemove,
  150.     ID_vuMeter
  151. };
  152.  
  153.  
  154. #endif
  155.