home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / vrac / mikmod43.zip / MODLOAD.H < prev    next >
C/C++ Source or Header  |  1994-04-28  |  2KB  |  87 lines

  1. #ifndef MODLOAD_H
  2. #define MODLOAD_H
  3.  
  4. #include <stdio.h>
  5. #include "mytypes.h"
  6.  
  7.  
  8. typedef struct MSAMPINFO{    // sample header as it appears in a module
  9.     UBYTE samplename[22];
  10.     UWORD length;
  11.     UBYTE finetune;
  12.     UBYTE volume;
  13.     UWORD reppos;
  14.     UWORD replen;
  15. } MSAMPINFO;
  16.  
  17.  
  18.  
  19. typedef struct SAMPLEINFO{    // new sample info with some converted types
  20.     char  samplename[23];            // name of the sample
  21.     int      handle;                    // handle <- NEW since 0.4
  22.     UBYTE finetune;                    // finetune value
  23.     UBYTE volume;                    // volume 0-64
  24.     ULONG length;                    // length of sample (in bytes)
  25.     ULONG reppos;                    // repeat position (relative to start)
  26.     ULONG replen;                    // repeat length
  27. } SAMPLEINFO;
  28.  
  29.  
  30.  
  31. typedef struct MODULEHEADER{    // verbatim module header
  32.     UBYTE      songname[20];            // the songname..
  33.     MSAMPINFO  samples[31];                // all sampleinfo
  34.     UBYTE      songlength;                // number of patterns used
  35.     UBYTE      magic1;                    // should be 127
  36.     UBYTE      positions[128];            // which pattern to play at pos
  37.     UBYTE      magic2[4];                // string "M.K." or "FLT4" or "FLT8"
  38. } MODULEHEADER;
  39.  
  40.  
  41. typedef struct OLDMODULEHEADER{            // verbatim module header
  42.     UBYTE      songname[20];            // the songname..
  43.     MSAMPINFO  samples[15];                // all sampleinfo
  44.     UBYTE      songlength;                // number of patterns used
  45.     UBYTE      magic1;                    // should be 127
  46.     UBYTE      positions[128];            // which pattern to play at pos
  47. } OLDMODULEHEADER;
  48.  
  49.  
  50.  
  51. typedef struct MODTYPE{                // struct to identify type of module
  52.     char     id[4];
  53.     UBYTE    channels;
  54.     char     *name;
  55. } MODTYPE;
  56.  
  57.  
  58.  
  59. typedef struct MODFILE{
  60.     int            userfp;                // 1 if user supplied fp
  61.     FILE        *fp;                  // filepointer to modfile
  62.     char         songname[21];        // name of the song
  63.     int          numchn;                // number of tracks per pattern
  64.     int          numpat;                // number of patterns in this song
  65.     int          numsmp;                // number of samples
  66.     char         *modtype;            // string type of module
  67.     UBYTE         songlength;            // number of positions in this song
  68.     UBYTE         positions[128];        // all positions
  69.     void       *patterns[128];        // all patterns
  70.     SAMPLEINFO    samples[31];        // all samples
  71. } MODFILE;
  72.  
  73.  
  74. // Function prototypes:
  75.  
  76. MODFILE *ML_Open(char filename[],FILE *fp);
  77. int       ML_Load(MODFILE *mf);
  78. void      ML_Free(MODFILE *mf);
  79. void      ML_Load15(int yesno);
  80.  
  81.  
  82. void ML_RegisterLoader(int (*Loader)(FILE *fp,SAMPLEINFO *smp));
  83. void ML_RegisterUnLoader(void (*UnLoader)(int handle,SAMPLEINFO *smp));
  84. const char *ML_Error(void);
  85.  
  86. #endif
  87.