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

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