Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. ;  uFMOD header file
  2. ;  Target OS: KolibriOS
  3. ;  Compiler:  MASM32
  4.  
  5. ;  HANDLE uFMOD_LoadSong(
  6. ;     void *lpXM,
  7. ;     void *param,
  8. ;     int fdwSong
  9. ;  )
  10. ;  ---
  11. ;  Description:
  12. ;  ---
  13. ;     Loads the given XM song and starts playing it as soon as you
  14. ;     call uFMOD_WaveOut for the first time. Playback won't begin
  15. ;     if XM_SUSPENDED flag is specified. It will stop any currently
  16. ;     playing song before loading the new one.
  17. ;  ---
  18. ;  Parameters:
  19. ;  ---
  20. ;    lpXM
  21. ;       Specifies the song to load. If this parameter is 0, any
  22. ;       currently playing song is stopped. In such a case, function
  23. ;       does not return a meaningful value. fdwSong parameter
  24. ;       determines whether this value is interpreted as a filename
  25. ;       or as a pointer to an image of the song in memory.
  26. ;    param
  27. ;       If XM_MEMORY is specified, this parameter should be the size
  28. ;       of the image of the song in memory.
  29. ;       If XM_FILE is specified, this parameter is ignored.
  30. ;    fdwSong
  31. ;       Flags for playing the song. The following values are defined:
  32. ;       XM_FILE      lpXM points to filename. param is ignored.
  33. ;       XM_MEMORY    lpXM points to an image of a song in memory.
  34. ;                    param is the image size. Once, uFMOD_LoadSong
  35. ;                    returns, it's safe to free/discard the memory
  36. ;                    buffer.
  37. ;       XM_NOLOOP    An XM track plays repeatedly by default. Specify
  38. ;                    this flag to play it only once.
  39. ;       XM_SUSPENDED The XM track is loaded in a suspended state,
  40. ;                    and will not play until the uFMOD_Resume function
  41. ;                    is called. This is useful for preloading a song
  42. ;                    or testing an XM track for validity.
  43. ;  ---
  44. ;  Return Values:
  45. ;  ---
  46. ;     On success, returns the handle of the Infinity Sound driver.
  47. ;     Returns 0 on failure.
  48. uFMOD_LoadSong PROTO C :DWORD,:DWORD,:DWORD
  49.  
  50. ;  int uFMOD_WaveOut(void)
  51. ;  ---
  52. ;  Description:
  53. ;  ---
  54. ;     Updates the internal playback buffer.
  55. ;  ---
  56. ;  Remarks:
  57. ;  ---
  58. ;     This function should be called from the same thread
  59. ;     uFMOD_LoadSong was previously called. Playback doesn't actually
  60. ;     begin when calling uFMOD_LoadSong, but when calling uFMOD_WaveOut
  61. ;     after a successful uFMOD_LoadSong call. Afterwards, you should
  62. ;     call uFMOD_WaveOut repeatedly at least once every 250 ms to
  63. ;     prevent "buffer underruns".
  64. ;     uFMOD_WaveOut is a non-blocking function. The accuracy of the
  65. ;     InfoAPI functions (uFMOD_GetStats, uFMOD_GetRowOrder and
  66. ;     uFMOD_GetTime) depends on the periodicity of this function being
  67. ;     invoked.
  68. ;  ---
  69. ;  Return Values:
  70. ;  ---
  71. ;     Returns non zero on error.
  72. uFMOD_WaveOut PROTO C
  73.  
  74. ;  void uFMOD_StopSong(void)
  75. ;  ---
  76. ;  Description:
  77. ;  ---
  78. ;     Stops the currently playing song, freeing the associated
  79. ;     resources.
  80. ;  ---
  81. ;  Remarks:
  82. ;  ---
  83. ;     Does nothing if no song is playing at the time the call is made.
  84. uFMOD_StopSong PROTO C
  85.  
  86. ;  void uFMOD_Jump2Pattern(
  87. ;     unsigned int pat
  88. ;  )
  89. ;  ---
  90. ;  Description:
  91. ;  ---
  92. ;     Jumps to the specified pattern index.
  93. ;  ---
  94. ;  Parameters:
  95. ;  ---
  96. ;     pat
  97. ;        Next zero based pattern index.
  98. ;  ---
  99. ;  Remarks:
  100. ;  ---
  101. ;     uFMOD doesn't automatically perform Note Off effects before jumping
  102. ;     to the target pattern. In other words, the original pattern will
  103. ;     remain in the mixer until it fades out. You can use this feature to
  104. ;     your advantage. If you don't like it, just insert leading Note Off
  105. ;     commands in all patterns intended to be used as uFMOD_Jump2Pattern
  106. ;     targets.
  107. ;     if the pattern index lays outside of the bounds of the pattern order
  108. ;     table, calling this function jumps to pattern 0, effectively
  109. ;     rewinding playback.
  110. uFMOD_Jump2Pattern PROTO C :DWORD
  111.  
  112. ;  void uFMOD_Pause(void)
  113. ;  ---
  114. ;  Description:
  115. ;  ---
  116. ;     Pauses the currently playing song, if any.
  117. ;  ---
  118. ;  Remarks:
  119. ;  ---
  120. ;     While paused you can still control the volume (uFMOD_SetVolume) and
  121. ;     the pattern order (uFMOD_Jump2Pattern). The RMS volume coefficients
  122. ;     (uFMOD_GetStats) will go down to 0 and the progress tracker
  123. ;     (uFMOD_GetTime) will "freeze" while the song is paused.
  124. ;     uFMOD_Pause doesn't perform the request immediately. Instead, it
  125. ;     signals to pause when playback reaches next chunk of data.
  126. ;     This way, uFMOD_Pause performs asynchronously and returns very fast.
  127. ;     It is not cumulative. So, calling uFMOD_Pause many times in a row
  128. ;     has the same effect as calling it once.
  129. ;     You shouldn't stop calling uFMOD_WaveOut while the song is paused!
  130. uFMOD_Pause PROTO C
  131.  
  132. ;  void uFMOD_Resume(void)
  133. ;  ---
  134. ;  Description:
  135. ;  ---
  136. ;     Resumes the currently paused song, if any.
  137. ;  ---
  138. ;  Remarks:
  139. ;  ---
  140. ;     uFMOD_Resume doesn't perform the request immediately. Instead, it
  141. ;     signals to resume when uFMOD_WaveOut is called again. uFMOD_Resume
  142. ;     is not cumulative. So, calling it many times in a row has the same
  143. ;     effect as calling it once.
  144. uFMOD_Resume PROTO C
  145.  
  146. ;  unsigned int uFMOD_GetStats(void)
  147. ;  ---
  148. ;  Description:
  149. ;  ---
  150. ;     Returns the current RMS volume coefficients in (L)eft and (R)ight
  151. ;     channels.
  152. ;        low-order word: RMS volume in R channel
  153. ;        hi-order word:  RMS volume in L channel
  154. ;     Range from 0 (silence) to $7FFF (maximum) on each channel.
  155. ;  ---
  156. ;  Remarks:
  157. ;  ---
  158. ;     This function is useful for updating a VU meter. It's recommended
  159. ;     to rescale the output to log10 (decibels or dB for short), because
  160. ;     human ears track volume changes in a dB scale. You may call
  161. ;     uFMOD_GetStats() as often as you like, but take in mind that uFMOD
  162. ;     updates both channel RMS volumes at the same rate uFMOD_WaveOut
  163. ;     function is called. In other words, you should call uFMOD_WaveOut
  164. ;     more often to increase the accuracy of uFMOD_GetStats.
  165. uFMOD_GetStats PROTO C
  166.  
  167. ;  unsigned int uFMOD_GetRowOrder(void)
  168. ;  ---
  169. ;  Description:
  170. ;  ---
  171. ;     Returns the currently playing row and order.
  172. ;        low-order word: row
  173. ;        hi-order word:  order
  174. ;  ---
  175. ;  Remarks:
  176. ;  ---
  177. ;     This function is useful for synchronization. uFMOD updates both
  178. ;     row and order values at the same rate uFMOD_WaveOut function is
  179. ;     called. In other words, you should call uFMOD_WaveOut more often
  180. ;     to increase the accuracy of uFMOD_GetRowOrder.
  181. uFMOD_GetRowOrder PROTO C
  182.  
  183. ;  unsigned int uFMOD_GetTime(void)
  184. ;  ---
  185. ;  Description:
  186. ;  ---
  187. ;     Returns the time in milliseconds since the song was started.
  188. ;  ---
  189. ;  Remarks:
  190. ;  ---
  191. ;     This function is useful for synchronizing purposes. Multimedia
  192. ;     applications can use uFMOD_GetTime to synchronize GFX to sound,
  193. ;     for example. An XM player can use this function to update a progress
  194. ;     meter.
  195. uFMOD_GetTime PROTO C
  196.  
  197. ;  unsigned char* uFMOD_GetTitle(void)
  198. ;  ---
  199. ;  Description:
  200. ;  ---
  201. ;     Returns the current song's title.
  202. ;  ---
  203. ;  Remarks:
  204. ;  ---
  205. ;     Not every song has a title, so be prepared to get an empty string.
  206. uFMOD_GetTitle PROTO C
  207.  
  208. ;  void uFMOD_SetVolume(
  209. ;     unsigned int vol
  210. ;  )
  211. ;  ---
  212. ;  Description:
  213. ;  ---
  214. ;     Sets the global volume. The volume scale is linear.
  215. ;  ---
  216. ;  Parameters:
  217. ;  ---
  218. ;     vol
  219. ;        New volume. Range: from uFMOD_MIN_VOL (muting) to uFMOD_MAX_VOL
  220. ;        (maximum volume). Any value above uFMOD_MAX_VOL maps to maximum
  221. ;        volume.
  222. ;  ---
  223. ;  Remarks:
  224. ;  ---
  225. ;     uFMOD internally converts the given values to a logarithmic scale (dB).
  226. ;     Maximum volume is set by default. The volume value is preserved across
  227. ;     uFMOD_LoadSong calls. You can set the desired volume level before
  228. ;     actually starting to play a song.
  229. ;     You can use Infinity Sound API to control the L and R channels volumes
  230. ;     separately. It also has a wider range than uFMOD_SetVolume, sometimes
  231. ;     allowing to amplify the sound volume as well, as opposed to
  232. ;     uFMOD_SetVolume only being able to attenuate it.
  233. uFMOD_SetVolume PROTO C :DWORD
  234.  
  235. XM_MEMORY         EQU 1
  236. XM_FILE           EQU 2
  237. XM_NOLOOP         EQU 8
  238. XM_SUSPENDED      EQU 16
  239. uFMOD_MIN_VOL     EQU 0
  240. uFMOD_MAX_VOL     EQU 25
  241. uFMOD_DEFAULT_VOL EQU 25