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

  1. /*      MOD.H
  2.  *
  3.  * ProTracker Module Player, v1.10
  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 __MOD_H
  15. #define __MOD_H
  16.  
  17.  
  18. /****************************************************************************\
  19. *       struct modInstHdr
  20. *       -----------------
  21. * Description:  Protracker module instrument header. Note that all 16-bit
  22. *               fields are big-endian.
  23. \****************************************************************************/
  24.  
  25. typedef struct
  26. {
  27.     char        iname[22];              /* instrument name */
  28.     ushort      slength;                /* sample length */
  29.     uchar       finetune;               /* sample finetune value */
  30.     uchar       volume;                 /* sample default volume */
  31.     ushort      loopStart;              /* sample loop start, in words */
  32.     ushort      loopLength;             /* sample loop length, in words */
  33. } modInstHdr;
  34.  
  35.  
  36.  
  37. /****************************************************************************\
  38. *       struct modHeader
  39. *       ----------------
  40. * Description:  Protracker module file header
  41. \****************************************************************************/
  42.  
  43. typedef struct
  44. {
  45.     char        songName[20];           /* song name */
  46.     modInstHdr  instruments[31];        /* instrument headers */
  47.     uchar       songLength;             /* song length */
  48.     uchar       unused;                 /* unused by Protracker, used to be
  49.                                            song restart position */
  50.     uchar       orders[128];            /* pattern playing orders */
  51.     char        sign[4];                /* module signature */
  52. } modHeader;
  53.  
  54.  
  55.  
  56.  
  57. /****************************************************************************\
  58. *       .MTM stuff. Not used currently
  59. \****************************************************************************/
  60.  
  61. typedef struct
  62. {
  63.         char    iName[22];
  64.         ulong   sLength;
  65.         ulong   loopStart;
  66.         ulong   loopEnd;
  67.         uchar   fineTune;
  68.         uchar   volume;
  69.         struct  attributes
  70.         {
  71.             int bits : 1;
  72.             int unsused : 7;
  73.         } attr;
  74. } mtmInstHdr;
  75.  
  76.  
  77. typedef struct
  78. {
  79.         char        sign[3];
  80.         uchar       version;
  81.         char        sName[20];
  82.         ushort      numTracks;
  83.         uchar       lastPattern;
  84.         uchar       lastOrder;
  85.         ushort      lenComment;
  86.         uchar       numInsts;
  87.         uchar       attribute;
  88.         uchar       beatsPerTrack;
  89.         uchar       amountTracks;
  90.         uchar       panPositions[32];
  91.         mtmInstHdr  instruments[];
  92. } mtmHdr;
  93.  
  94.  
  95.  
  96. /****************************************************************************\
  97. *       struct modChannel
  98. *       -----------------
  99. * Description:  Protracker Module Player internal channel structure
  100. \****************************************************************************/
  101.  
  102. typedef struct
  103. {
  104.     uchar   note;
  105.     uchar   inst;
  106.     uchar   cmd;
  107.     uchar   info;
  108.     uchar   comp;
  109.  
  110.     uchar   sample;
  111.     uchar   volume;
  112.  
  113.     ushort  period;
  114.     ushort  snote;
  115.     uchar   loff;
  116.     uchar   coff;
  117.     ushort  toperi;
  118.     uchar   notepsp;
  119.     uchar   retrigc;
  120.  
  121.     uchar   status;
  122.  
  123.     uchar   vibcmd;
  124.     uchar   vibpos;
  125.  
  126.     uchar   trecmd;
  127.     uchar   trepos;
  128.  
  129.     uchar   volbar;
  130.     ushort  playoff;
  131. } modChannel;
  132.  
  133.  
  134.  
  135. extern ModulePlayer mpMOD;              /* Protracker Module Player */
  136.  
  137.  
  138.  
  139. #ifdef __cplusplus
  140. extern "C" {
  141. #endif
  142.  
  143.  
  144. /****************************************************************************\
  145. *
  146. * Function:     int modLoadModule(char *fileName, SoundDevice *SD,
  147. *                   mpModule **module);
  148. *
  149. * Description:  Loads a Protracker module into memory
  150. *
  151. * Input:        char *fileName          name of module file to be loaded
  152. *               SoundDevice *SD         Sound Device which will store the
  153. *                                       samples
  154. *               mpModule **module       pointer to variable which will store
  155. *                                       the module pointer.
  156. *
  157. * Returns:      MIDAS error code.
  158. *               Pointer to module structure is stored in *module.
  159. *
  160. \****************************************************************************/
  161.  
  162. int CALLING modLoadModule(char *fileName, SoundDevice *SD, mpModule **module);
  163.  
  164.  
  165.  
  166. /****************************************************************************\
  167. *
  168. * Function:     int modFreeModule(mpModule *module, SoundDevice *SD);
  169. *
  170. * Description:  Deallocates a Protracker module
  171. *
  172. * Input:        mpModule *module        module to be deallocated
  173. *               SoundDevice *SD         Sound Device that has stored the
  174. *                                       samples
  175. *
  176. * Returns:      MIDAS error code
  177. *
  178. \****************************************************************************/
  179.  
  180. int CALLING modFreeModule(mpModule *module, SoundDevice *sd);
  181.  
  182.  
  183. int CALLING modConvertSample(uchar *sample, ushort length);
  184. int CALLING modConvertTrack(void *track, ushort type, ushort *trackLen);
  185.  
  186. int CALLING modIdentify(uchar *header, int *recognized);
  187. int CALLING modInit(SoundDevice *SD);
  188. int CALLING modClose(void);
  189. int CALLING modPlayModule(mpModule *module, ushort firstSDChannel,
  190.     ushort numSDChannels, ushort loopStart, ushort loopEnd);
  191. int CALLING modStopModule(void);
  192. int CALLING modSetInterrupt(void);
  193. int CALLING modRemoveInterrupt(void);
  194. int CALLING modPlay(void);
  195. int CALLING modSetPosition(ushort pos);
  196. int CALLING modGetInformation(mpInformation *info);
  197.  
  198.  
  199.  
  200. /****************************************************************************\
  201. *       enum modFunctIDs
  202. *       ----------------
  203. * Description:  ID numbers for Protracker Module Player functions
  204. \****************************************************************************/
  205.  
  206. enum modFunctIDs
  207. {
  208.     ID_modIdentify = ID_mod,
  209.     ID_modInit,
  210.     ID_modClose,
  211.     ID_modLoadModule,
  212.     ID_modFreeModule,
  213.     ID_modPlayModule,
  214.     ID_modStopModule,
  215.     ID_modSetInterrupt,
  216.     ID_modRemoveInterrupt,
  217.     ID_modPlay,
  218.     ID_modSetPosition,
  219.     ID_modGetInformation,
  220.     ID_modConvertSample,
  221.     ID_modConvertTrack
  222. };
  223.  
  224.  
  225.  
  226.  
  227.  
  228. #ifdef __cplusplus
  229. }
  230. #endif
  231.  
  232.  
  233. #endif
  234.