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

  1. ;*    MIDAS.INC
  2. ;*
  3. ;* MIDAS Sound System main assembler include file.
  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. INCLUDE "lang.inc"
  15. INCLUDE "errors.inc"
  16. INCLUDE "mglobals.inc"
  17. INCLUDE "mmem.inc"
  18. INCLUDE "rawfile.inc"
  19. INCLUDE "file.inc"
  20. INCLUDE "sdevice.inc"
  21. INCLUDE "mplayer.inc"
  22. INCLUDE "timer.inc"
  23. INCLUDE "mod.inc"
  24. INCLUDE "s3m.inc"
  25. INCLUDE "dma.inc"
  26. INCLUDE "dsm.inc"
  27. INCLUDE "ems.inc"
  28. INCLUDE "vu.inc"
  29.  
  30.  
  31.  
  32.  
  33. ;/***************************************************************************\
  34. ;*     MIDAS Sound System global variables:
  35. ;\***************************************************************************/
  36.  
  37. GLOBAL  LANG GUS : SoundDevice          ; Gravis UltraSound Sound Device
  38. GLOBAL    LANG SB : SoundDevice        ; Sound Blaster Sound Device
  39. GLOBAL    LANG WSS : SoundDevice        ; Windows Sound System Sound Device
  40. GLOBAL    LANG PAS : SoundDevice        ; Pro Audio Spectrum Sound Device
  41. GLOBAL    LANG NSND : SoundDevice     ; No Sound Sound Device
  42.  
  43. NUMSDEVICES = 5             ; total number of Sound Devices
  44. NUMMPLAYERS = 2
  45.  
  46. GLOBAL    LANG mpS3M : ModulePlayer    ; Scream Tracker 3 Module Player
  47. GLOBAL    LANG mpMOD : ModulePlayer    ; Pro Tracker Module Player
  48.  
  49. GLOBAL    LANG SD : dword         ; far pointer to current Sound Device
  50. GLOBAL    LANG MP : dword         ; far pointer to current Module Player
  51.  
  52. GLOBAL    LANG midasSoundDevices : dword    ; pointers to all Sound Devices
  53. GLOBAL  LANG midasModulePlayers : dword ; pointers to all Module Players
  54. GLOBAL  LANG midasMPALE : word          ; Module Player ALE flags
  55.  
  56.  
  57.  
  58. ;/***************************************************************************\
  59. ;*    MIDAS global functions from MIDAS.C:
  60. ;\***************************************************************************/
  61.  
  62.  
  63. ;/***************************************************************************\
  64. ;*
  65. ;* Function:     void midasError(char *msg)
  66. ;*
  67. ;* Description:  Prints a MIDAS error message to stderr and exits to DOS
  68. ;*
  69. ;* Input:        char *msg               Pointer to error message string
  70. ;*
  71. ;\***************************************************************************/
  72.  
  73. GLOBAL  LANG midasError : far
  74.  
  75.  
  76.  
  77.  
  78. ;/***************************************************************************\
  79. ;*
  80. ;* Function:     void midasUninitError(char *msg)
  81. ;*
  82. ;* Description:  Prints an error message to stderr and exits to DOS without
  83. ;*               uninitializing MIDAS. This function should only be used
  84. ;*               from midasClose();
  85. ;*
  86. ;* Input:        char *msg               Pointer to error message string
  87. ;*
  88. ;\***************************************************************************/
  89.  
  90. GLOBAL  LANG midasUninitError : far
  91.  
  92.  
  93.  
  94. ;/***************************************************************************\
  95. ;*
  96. ;* Function:     void midasDetectSD(void)
  97. ;*
  98. ;* Description:  Attempts to detect a Sound Device. Sets the global variable
  99. ;*               SD to point to the detected Sound Device or NULL if no
  100. ;*               Sound Device was detected
  101. ;*
  102. ;\***************************************************************************/
  103.  
  104. GLOBAL  LANG midasDetectSD : far
  105.  
  106.  
  107.  
  108. ;/***************************************************************************\
  109. ;*
  110. ;* Function:     void midasInit(void)
  111. ;*
  112. ;* Description:  Initializes MIDAS Sound System
  113. ;*
  114. ;\***************************************************************************/
  115.  
  116. GLOBAL  LANG midasInit : far
  117.  
  118.  
  119.  
  120. ;/***************************************************************************\
  121. ;*
  122. ;* Function:     void midasClose(void)
  123. ;*
  124. ;* Description:  Uninitializes MIDAS Sound System
  125. ;*
  126. ;\***************************************************************************/
  127.  
  128. GLOBAL  LANG midasClose : far
  129.  
  130.  
  131.  
  132. ;/***************************************************************************\
  133. ;*
  134. ;* Function:     void midasSetDefaults(void)
  135. ;*
  136. ;* Description:  Initializes MIDAS Sound System variables to their default
  137. ;*               states. MUST be the first MIDAS function to be called.
  138. ;*
  139. ;\***************************************************************************/
  140.  
  141. GLOBAL  LANG midasSetDefaults : far
  142.  
  143.  
  144.  
  145. ;/***************************************************************************\
  146. ;*
  147. ;* Function:     void midasParseOption(char *option)
  148. ;*
  149. ;* Description:  Parses one MIDAS command line option.
  150. ;*
  151. ;* Input:        char *option            Command line option string WITHOUT
  152. ;*                                       the leading '-' or '/'.
  153. ;*
  154. ;* Recognized options:
  155. ;*       -sx     Force Sound Device x (1 = GUS, 2 = PAS, 3 = WSS, 4 = SB,
  156. ;*               5 = No Sound)
  157. ;*       -pxxx   Force I/O port xxx (hex) for Sound Device
  158. ;*       -ix     Force IRQ x for Sound Device
  159. ;*       -dx     Force DMA channel x for Sound Device
  160. ;*       -mxxxx  Set mixing rate to xxxx Hz
  161. ;*       -oxxx   Force output mode (8 = 8-bit, 1 = 16-bit, s = stereo,
  162. ;*               m = mono)
  163. ;*       -e      Disable EMS usage
  164. ;*       -t      Disable ProTracker BPM tempos
  165. ;*       -u      Enable Surround sound
  166. ;*       -v      Disable real VU-meters
  167. ;*
  168. ;\***************************************************************************/
  169.  
  170. GLOBAL  LANG midasParseOption : far
  171.  
  172.  
  173.  
  174. ;/***************************************************************************\
  175. ;*
  176. ;* Function:     void midasParseOptions(int optCount, char **options)
  177. ;*
  178. ;* Description:  Parses MIDAS command line options and sets MIDAS variables
  179. ;*               accordingly.
  180. ;*
  181. ;* Input:        int optCount            Number of options
  182. ;*               char **options          Pointer to an array of pointers to
  183. ;*                                       option strings.
  184. ;*
  185. ;* Also '/' is recognized as a option delimiter.
  186. ;*
  187. ;\***************************************************************************/
  188.  
  189. GLOBAL  LANG midasParseOptions : far
  190.  
  191.  
  192.  
  193. ;/***************************************************************************\
  194. ;*
  195. ;* Function:     void midasParseEnvironment(void)
  196. ;*
  197. ;* Description:  Parses the MIDAS environment string, which has same format
  198. ;*               as the command line options.
  199. ;*
  200. ;\***************************************************************************/
  201.  
  202. GLOBAL  LANG midasParseEnvironment : far
  203.  
  204.  
  205.  
  206. ;/***************************************************************************\
  207. ;*
  208. ;* Function:     mpModule *midasPlayModule(char *fileName, int numEffectChns)
  209. ;*
  210. ;* Description:  Loads a module into memory, points MP to the correct Module
  211. ;*               Player and starts playing it.
  212. ;*
  213. ;* Input:        char *fileName          Pointer to module file name
  214. ;*               int numEffectChns       Number of channels to open for sound
  215. ;*                                       effects.
  216. ;*
  217. ;* Returns:      Pointer to module structure. This function can not fail,
  218. ;*               as it will call midasError() to handle all error cases.
  219. ;*
  220. ;* Notes:        The Sound Device channels available for sound effects are the
  221. ;*               _first_ numEffectChns channels. So, for example, if you use
  222. ;*               midasPlayModule("TUNE.MOD", 3), you can use channels 0-2 for
  223. ;*               sound effects.
  224. ;*
  225. ;\***************************************************************************/
  226.  
  227. GLOBAL  LANG midasPlayModule : far
  228.  
  229.  
  230.  
  231. ;/***************************************************************************\
  232. ;*
  233. ;* Function:     void midasStopModule(mpModule *module)
  234. ;*
  235. ;* Description:  Stops playing a module, deallocates it and uninitializes
  236. ;*               the Module Player. Also closes _all_ Sound Device channels,
  237. ;*               including those opened for effects.
  238. ;*
  239. ;\***************************************************************************/
  240.  
  241. GLOBAL  LANG midasStopModule : far
  242.  
  243.  
  244.  
  245.  
  246.  
  247. ;/***************************************************************************\
  248. ;*     MIDAS global macros
  249. ;\***************************************************************************/
  250.  
  251.  
  252. ;/***************************************************************************\
  253. ;*
  254. ;* Macro:    SetBorder
  255. ;*
  256. ;* Description: Sets the border color. Will be disabled if NOBORDERCOLOR
  257. ;*        is defined
  258. ;*
  259. ;* Input:    color            new border color
  260. ;*
  261. ;\***************************************************************************/
  262.  
  263. MACRO    SetBorder    color
  264. IFNDEF NOBORDERCOLOR
  265.     push    dx ax
  266.     mov    dx,03DAh
  267.     in    al,dx
  268.     mov    dx,03C0h
  269.     mov    al,31h
  270.     out    dx,al
  271.     mov    al,color
  272.     out    dx,al
  273.     pop    ax dx
  274. ENDIF
  275. ENDM
  276.