home *** CD-ROM | disk | FTP | other *** search
/ PC Loisirs 18 / cd.iso / sharewar / mikm202 / source / include / mtypes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-18  |  6.5 KB  |  221 lines

  1. #ifndef MTYPES_H
  2. #define MTYPES_H
  3.  
  4. #ifdef __WATCOMC__
  5.  
  6. #define inportb(x) inp(x)
  7. #define outportb(x,y) outp(x,y)
  8. #define disable() _disable()
  9. #define enable() _enable()
  10.  
  11. #endif
  12.  
  13.  
  14.  
  15. #ifdef __WATCOMC__
  16.  
  17. #define mikbanner \
  18. "============================================================================\n" \
  19. "MIKMOD v2.02 - Protected mode version - Programmed by MikMak of HaRDCoDE '95\n" \
  20. "============================================================================\n" \
  21. "This program is SHAREWARE - Read MIKMOD.TXT for more info\n" \
  22. "E-Mail : mikmak@stack.urc.tue.nl\n"
  23.  
  24. #else
  25.  
  26. #define mikbanner \
  27. "=======================================================================\n" \
  28. "MIKMOD v2.02 - Real mode version - Programmed by MikMak of HaRDCoDE '95\n" \
  29. "=======================================================================\n" \
  30. "This program is SHAREWARE - Read MIKMOD.TXT for more info\n" \
  31. "E-Mail : mikmak@stack.urc.tue.nl\n"
  32.  
  33. #endif
  34.  
  35.  
  36. /*
  37.     MikMod atomic types:
  38.     ====================
  39. */
  40.  
  41. typedef char            BYTE;           // has to be 1 byte signed
  42. typedef unsigned char   UBYTE;          // has to be 1 byte unsigned
  43. typedef short           WORD;           // has to be 2 bytes signed
  44. typedef unsigned short  UWORD;          // has to be 2 bytes unsigned
  45. typedef long            LONG;           // has to be 4 bytes signed
  46. typedef unsigned long   ULONG;          // has to be 4 bytes unsigned
  47. typedef int                             BOOL;           // doesn't matter.. 0=FALSE, <>0 true
  48.  
  49.  
  50.  
  51. /*
  52.     error variables:
  53.     ===============
  54. */
  55.  
  56. extern char *ERROR_ALLOC_STRUCT;
  57. extern char *ERROR_LOADING_PATTERN;
  58. extern char *ERROR_LOADING_TRACK;
  59. extern char *ERROR_LOADING_HEADER;
  60. extern char *ERROR_NOT_A_MODULE;
  61. extern char *ERROR_LOADING_SAMPLEINFO;
  62. extern char *ERROR_OUT_OF_HANDLES;
  63. extern char *ERROR_SAMPLE_TOO_BIG;
  64. extern char *myerr;
  65.  
  66.  
  67.  
  68. /*
  69.     MikMod sample types:
  70.     ====================
  71. */
  72.  
  73. #define SF_16BITS       1
  74. #define SF_SIGNED   4
  75. #define SF_LOOP         8
  76. #define SF_BIDI         16
  77. #define SF_DELTA        32
  78. #define SF_OWNPAN       64
  79.  
  80. #define EF_ON           1
  81. #define EF_SUSTAIN      2
  82. #define EF_LOOP         4
  83.  
  84. #define UF_XMPERIODS    1               // if set use XM periods/finetuning
  85. #define UF_LINEAR               2               // if set use LINEAR periods
  86.  
  87.  
  88. typedef struct ENVPT{
  89.     WORD pos;
  90.     WORD val;
  91. } ENVPT;
  92.  
  93. typedef struct SAMPLE{  // new sample info with some converted types
  94.     UWORD c2spd;            // finetune frequency
  95.     BYTE  transpose;                // transpose value
  96.     UBYTE volume;                   // volume 0-64
  97.     UBYTE panning;                  // panning
  98.     ULONG length;                   // length of sample (in samples!)
  99.     ULONG loopstart;                // repeat position (relative to start, in samples)
  100.     ULONG loopend;                  // repeat end
  101.     UWORD flags;
  102.     ULONG seekpos;
  103.     char *samplename;               // name of the sample
  104.     WORD  handle;                   // handle <- NEW since 0.4
  105. } SAMPLE;
  106.  
  107.  
  108. typedef struct UNISAMPLE{       // new sample info with some converted types
  109.     UWORD c2spd;            // finetune frequency
  110.     BYTE  transpose;                // transpose value
  111.     UBYTE volume;                   // volume 0-64
  112.     UBYTE panning;                  // panning
  113.     ULONG length;                   // length of sample (in samples!)
  114.     ULONG loopstart;                // repeat position (relative to start, in samples)
  115.     ULONG loopend;                  // repeat end
  116.     UWORD flags;
  117. } UNISAMPLE;
  118.  
  119.  
  120. typedef struct INSTRUMENT{
  121.     UBYTE numsmp;
  122.     UBYTE samplenumber[96];
  123.  
  124.     UBYTE volflg;                   // bit 0: on 1: sustain 2: loop
  125.     UBYTE volpts;
  126.     UBYTE volsus;
  127.     UBYTE volbeg;
  128.     UBYTE volend;
  129.     ENVPT volenv[12];
  130.  
  131.     UBYTE panflg;                   // bit 0: on 1: sustain 2: loop
  132.     UBYTE panpts;
  133.     UBYTE pansus;
  134.     UBYTE panbeg;
  135.     UBYTE panend;
  136.     ENVPT panenv[12];
  137.  
  138.     UBYTE vibtype;
  139.     UBYTE vibsweep;
  140.     UBYTE vibdepth;
  141.     UBYTE vibrate;
  142.  
  143.     UWORD volfade;
  144.     char  *insname;
  145.     SAMPLE *samples;
  146. } INSTRUMENT;
  147.  
  148.  
  149. // UNIINSTRUMENT has the same first members as INSTRUMENT
  150.  
  151. typedef struct UNIINSTRUMENT{
  152.     UBYTE numsmp;
  153.     UBYTE samplenumber[96];
  154.  
  155.     UBYTE volflg;                   // bit 0: on 1: sustain 2: loop
  156.     UBYTE volpts;
  157.     UBYTE volsus;
  158.     UBYTE volbeg;
  159.     UBYTE volend;
  160.     ENVPT volenv[12];
  161.  
  162.     UBYTE panflg;                   // bit 0: on 1: sustain 2: loop
  163.     UBYTE panpts;
  164.     UBYTE pansus;
  165.     UBYTE panbeg;
  166.     UBYTE panend;
  167.     ENVPT panenv[12];
  168.  
  169.     UBYTE vibtype;
  170.     UBYTE vibsweep;
  171.     UBYTE vibdepth;
  172.     UBYTE vibrate;
  173.  
  174.     UWORD volfade;
  175. } UNIINSTRUMENT;
  176.  
  177.  
  178. /*
  179.     MikMod UNImod types:
  180.     ====================
  181. */
  182.  
  183. typedef struct UNIMOD{
  184.     UBYTE           numchn;                         // number of channels
  185.     UWORD       numpos;                             // number of positions in this song
  186.     UWORD           numpat;                         // number of patterns in this song
  187.     UWORD           numtrk;                         // number of tracks
  188.     UWORD           numins;                         // number of samples
  189.     UBYTE           initspeed;                      //
  190.     UBYTE           inittempo;          //
  191.     UBYTE           positions[256];         // all positions
  192.     UBYTE           panning[32];            // 32 panning positions
  193.     UBYTE           flags;                          //
  194.     char       *songname;                   // name of the song
  195.     char       *modtype;                    // string type of module
  196.     char       *comment;                    // module comments
  197.     INSTRUMENT *instruments;                // all samples
  198.     UWORD      *patterns;                   // array of PATTERN
  199.     UWORD      *pattrows;                   // array of number of rows for each pattern
  200.     UBYTE     **tracks;                             // array of pointers to tracks
  201. } UNIMOD;
  202.  
  203.  
  204. // UNIHEADER has the same first members as the head of a UNIMOD
  205.  
  206. typedef struct UNIHEADER{
  207.     UBYTE           numchn;                         // number of channels
  208.     UWORD       numpos;                             // number of positions in this song
  209.     UWORD           numpat;                         // number of patterns in this song
  210.     UWORD           numtrk;                         // number of tracks
  211.     UWORD           numsmp;                         // number of samples
  212.     UBYTE           initspeed;                      //
  213.     UBYTE           inittempo;          //
  214.     UBYTE           positions[256];         // all positions
  215.     UBYTE           panning[32];            // 32 panning positions
  216.     UBYTE           flags;
  217. } UNIHEADER;
  218.  
  219.  
  220. #endif
  221.