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

  1. /*      MPLAYER.H
  2.  *
  3.  * Module Player definitions
  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.  
  15. #ifndef __MPLAYER_H
  16. #define __MPLAYER_H
  17.  
  18.  
  19. #define MPHDRSIZE 1084                  /* header size needed for
  20.                                            ModulePlayer.Identify() */
  21.  
  22.  
  23.  
  24. /****************************************************************************\
  25. *       enum mpStatus
  26. *       -------------
  27. * Description:  Module Player status
  28. \****************************************************************************/
  29.  
  30. enum mpStatus
  31. {
  32.     mpUnInitialized = 0,                /* Module Player is uninitialized */
  33.     mpInitialized,                      /* initialized */
  34.     mpPlaying,                          /* currently playing a module */
  35.     mpStopped                           /* stopped */
  36. };
  37.  
  38.  
  39.  
  40. /****************************************************************************\
  41. *       enum modIDNumbers
  42. *       -----------------
  43. * Description:  mpModule ID numbers
  44. \****************************************************************************/
  45.  
  46. enum modIDNumbers
  47. {
  48.     idS3M = 0,                          /* Scream Tracker 3 module */
  49.     idMOD = 1,                          /* Protracker module */
  50. };
  51.  
  52.  
  53.  
  54. /****************************************************************************\
  55. *       struct mpChanInfo
  56. *       -----------------
  57. * Description:  Module Player channel info structure
  58. \****************************************************************************/
  59.  
  60. typedef struct
  61. {
  62.     uchar   flags;                      /* bits 0-4 - UNDEFINED
  63.                                            bit 5 - new note and/or instrument
  64.                                            bit 6 - new volume (S3M)
  65.                                            bit 7 - command */
  66.     uchar   note;                       /* note number */
  67.     uchar   instrument;                 /* instrument number */
  68.     uchar   volume;                     /* playing volume */
  69.     uchar   command;                    /* command number */
  70.     uchar   infobyte;                   /* command infobyte */
  71.     uchar   volumebar;                  /* "fake" volume bar */
  72.     char    (far *commandname);         /* pointer to command name string,
  73.                                            ASCIIZ */
  74. } mpChanInfo;
  75.  
  76.  
  77.  
  78.  
  79. /****************************************************************************\
  80. *       struct mpInformation
  81. *       --------------------
  82. * Description:  Module Player information structure
  83. \****************************************************************************/
  84.  
  85. typedef struct
  86. {
  87.     ushort      numChannels;            /* number of channels. MUST be set by
  88.                                            the routine calling
  89.                                            MP->GetInformation() */
  90.     ushort      setFrame;               /* 1 if "set frame", 0 if not */
  91.     ushort      speed;                  /* playing speed */
  92.     ushort      BPM;                    /* playing BPM tempo */
  93.     ushort      pos;                    /* current playing position */
  94.     ushort      pattern;                /* current pattern number */
  95.     ushort      row;                    /* current row number */
  96.     ushort      loopCnt;                /* song loop counter */
  97.     mpChanInfo  *chans;                 /* pointer to channel data structures.
  98.                                            MUST be allocated by the routine
  99.                                            calling MP->GetInformation() */
  100. } mpInformation;
  101.  
  102.  
  103.  
  104. /****************************************************************************\
  105. *       struct mpInstrument
  106. *       -------------------
  107. * Description:  Module Player instrument structure in memory
  108. \****************************************************************************/
  109.  
  110. typedef struct
  111. {
  112.     char        fileName[13];           /* DOS file name, ASCIIZ */
  113.     char        iname[32];              /* instrument name, ASCIIZ */
  114.     uchar       *sample;                /* pointer to sample data or NULL
  115.                                            if not available (no sample or
  116.                                            deallocated) */
  117.     ushort      length;                 /* sample length */
  118.     ushort      loopStart;              /* sample loop start */
  119.     ushort      loopEnd;                /* sample loop end */
  120.     uchar       looping;                /* 1 if looping sample, 0 if not */
  121.     uchar       volume;                 /* sample default playing volume */
  122.     ulong       c2Rate;                 /* C2 sampling rate */
  123.     uchar       finetune;               /* sample default finetune value */
  124.     ushort      sdInstHandle;           /* Sound Device instrument handle for
  125.                                            this instrument or 0 if not added
  126.                                            to Sound Device instrument list */
  127. } mpInstrument;
  128.  
  129.  
  130.  
  131. /****************************************************************************\
  132. *       struct mpPattern
  133. *       ----------------
  134. * Description:  Module Player pattern structure in memory
  135. \****************************************************************************/
  136.  
  137. typedef struct
  138. {
  139.     ushort      length;                 /* pattern data length in bytes */
  140.     uchar       data[];                 /* actual pattern data */
  141. } mpPattern;
  142.  
  143.  
  144.  
  145. /****************************************************************************\
  146. *       struct mpModule
  147. *       ---------------
  148. * Description:  Module Player module in memory
  149. \****************************************************************************/
  150.  
  151. typedef struct
  152. {
  153.     char        ID[4];                  /* Module identifier */
  154.     ushort      IDnum;                  /* ID number (0=S3M, 1=MOD) */
  155.     char        songName[32];           /* song name, ASCIIZ */
  156.     ushort      songLength;             /* number of orders */
  157.     ushort      numInsts;               /* number of instruments */
  158.     ushort      numPatts;               /* number of patterns */
  159.     ushort      numChans;               /* number of channels */
  160.     struct                              /* flags: (S3M) */
  161.     {
  162.         int     st2Vibrato : 1;         /* Scream Tracker 2 vibrato */
  163.         int     st2Tempo : 1;            /* Scream Tracker 2 tempo */
  164.         int     ptSlides : 1;            /* ProTracker slides */
  165.         int     zeroVolOpt : 1;         /* 0-volume optimizations */
  166.         int     ptLimits : 1;            /* ProTracker limits */
  167.         int     filter : 1;             /* Enable filter / sfx */
  168.         int     unused : 10;
  169.     } flags;
  170.     uchar       masterVol;              /* master volume */
  171.     uchar       speed;                  /* initial speed */
  172.     uchar       tempo;                  /* initial BPM tempo */
  173.     uchar       masterMult;             /* master multiplier */
  174.     uchar       stereo;                 /* 1 = stereo, 0 = mono */
  175.     signed char chanSettings[32];       /* channel panning values */
  176.     uchar       *orders;                /* pointer to pattern orders */
  177.     mpInstrument *insts;                /* pointer to instrument datas */
  178.     mpPattern   **patterns;             /* pointer to array of pattern
  179.                                            pointers */
  180.     uchar       *pattEMS;               /* one byte for each pattern - 1 if
  181.                                            pattern in ems, 0 if not */
  182.     uchar       *instsUsed;             /* one byte for each instrument - 1 if
  183.                                            instrument is used, 0 if not */
  184. } mpModule;
  185.  
  186.  
  187.  
  188. /****************************************************************************\
  189. *       struct ModulePlayer
  190. *       -------------------
  191. * Description:  Module Player structure. See MPLAYER.TXT for documentation
  192. \****************************************************************************/
  193.  
  194. typedef struct
  195. {
  196.     ushort      status;
  197.     ushort      updRate;
  198.  
  199.     int (far *Identify)(uchar *header, int *recognized);
  200.  
  201.     int (far *Init)(SoundDevice *SD);
  202.     int (far *Close)(void);
  203.  
  204.     int (far *LoadModule)(char *fileName, SoundDevice *SD, mpModule **module);
  205.     int (far *FreeModule)(mpModule *module, SoundDevice *SD);
  206.  
  207.     int (far *PlayModule)(mpModule *module, ushort firstSDChannel, ushort
  208.         numChannels, ushort loopStart, ushort loopEnd);
  209.     int (far *StopModule)(void);
  210.  
  211.     int (far *SetInterrupt)(void);
  212.     int (far *RemoveInterrupt)(void);
  213.  
  214.     int (far *Play)(void);
  215.  
  216.     int (far *SetPosition)(ushort pos);
  217.     int (far *GetInformation)(mpInformation *info);
  218.     int (far *SetMasterVolume)(uchar volume);
  219. } ModulePlayer;
  220.  
  221.  
  222.  
  223. #endif
  224.