home *** CD-ROM | disk | FTP | other *** search
/ Merciful 3 / Merciful_Release_3.bin / software / o / octamed / octamedv6.12.lha / programmers / proplayer.h < prev    next >
C/C++ Source or Header  |  1995-03-25  |  10KB  |  310 lines

  1. /* C definitions for using the 'proplayer.a' and 'pro8player.a'
  2.    play-routines of OctaMED Pro V3 - V6. OctaMED Pro V5 specific
  3.    features are marked as (V5) and V6 features as (V6) */
  4.  
  5. /* $VER: proplayer_h 6.0 (24.03.1995) */
  6.  
  7. #ifndef EXEC_TYPES_H
  8. #include <exec/types.h>
  9. #endif
  10.  
  11. #ifdef LATTICE
  12. #ifndef    OCTAPLR_LIB_PROTOS
  13. /* In 'proplayer.a' */
  14. LONG __asm InitPlayer(void);
  15. void __asm RemPlayer(void);
  16. void __asm PlayModule(register __a0 struct MMD0 *);
  17. void __asm ContModule(register __a0 struct MMD0 *);
  18. void __asm StopPlayer(void);
  19. void __asm SetTempo(register __d0 UWORD);
  20. /* In 'proloadmod.a' */
  21. struct MMD0 * __asm LoadModule(register __a0 char *);
  22. void __asm RelocModule(register __a0 struct MMD0 *);
  23. void __asm UnLoadModule(register __a0 struct MMD0 *);
  24. /* These are the definitions for the 8-channel OctaMED routines,
  25.    in 'pro8player.a' */
  26. LONG __asm InitPlayer8(void);
  27. void __asm RemPlayer8(void);
  28. void __asm PlayModule8(register __a0 struct MMD0 *);
  29. void __asm ContModule8(register __a0 struct MMD0 *);
  30. void __asm StopPlayer8(void);
  31. #endif
  32. #endif
  33.  
  34. /* If you're playing multi-modules, set the 'modnum' variable to the
  35.    number of the song you want to play before calling PlayModule(). */
  36.  
  37. #ifdef LATTICE_50
  38. extern UWORD far modnum;
  39.  
  40. /* 'modnum8' is the equivalent in 'mod8player' */
  41.  
  42. extern UWORD far modnum8;
  43. extern UBYTE far hq; /* (V6) */
  44. #else
  45. extern UWORD modnum,modnum8; /* for less intelligent compilers */
  46. extern UBYTE hq;
  47. #endif
  48.  
  49. /* This is the main module structure */
  50. struct MMD0 {    /* Also for MMD1 and MMD2 */
  51.     ULONG    id;            /* "MMD0" or "MMD1" */
  52.     ULONG    modlen;            /* module length (in bytes) */
  53.     struct    MMD0song *song;        /* pointer to MMD0song */
  54.     UWORD    psecnum;        /* (MMD2) - used by the player */
  55.     UWORD    pseq;            /* (MMD2) - used by the player */
  56.     struct    MMD0block **blockarr;    /* pointer to pointers of blocks */
  57.     ULONG    reserved1;
  58.     struct    MMDSample **smplarr;    /* pointer to pointers of samples */
  59.     ULONG    reserved2;
  60.     struct    MMD0exp *expdata;    /* pointer to expansion data */
  61.     ULONG    reserved3;
  62. /* The following values are used by the play routine */
  63.     UWORD    pstate;            /* the state of the player */
  64.     UWORD    pblock;            /* current block */
  65.     UWORD    pline;            /* current line */
  66.     UWORD    pseqnum;        /* current # of playseqlist */
  67.     WORD    actplayline;        /* OBSOLETE!! SET TO 0xFFFF! */
  68.     UBYTE    counter;        /* delay between notes */
  69.     UBYTE    extra_songs;        /* number of additional songs, see
  70.                        expdata->nextmod */
  71. };
  72.  
  73. /* These are the structures for future expansions */
  74.  
  75. struct InstrExt {    /* This struct only for data required for playing */
  76. /* NOTE: THIS STRUCTURE MAY GROW IN THE FUTURE, TO GET THE CORRECT SIZE,
  77.    EXAMINE mmd0->expdata->s_ext_entrsz */
  78. /* ALSO NOTE: THIS STRUCTURE MAY BE SHORTER THAN DESCRIBED HERE,
  79.    EXAMINE mmd0->expdata->s_ext_entrsz */
  80.     UBYTE hold;
  81.     UBYTE decay;
  82.     UBYTE suppress_midi_off;    /* 1 = suppress, 0 = don't */
  83.     BYTE  finetune;
  84.     UBYTE default_pitch;    /* (V5) */
  85.     UBYTE instr_flags;    /* (V5) */
  86.     UWORD long_midi_preset;    /* (V5), overrides the preset in the
  87.         song structure, if this exists, MMD0sample/midipreset
  88.         should not be used. */
  89.     UBYTE output_device;    /* (V5.02, V6) */
  90.     UBYTE reserved;        /* currently unused */
  91. };
  92.  
  93. /* Bits for instr_flags */
  94. #define SSFLG_LOOP    0x01
  95. #define    SSFLG_EXTPSET    0x02
  96. #define    SSFLG_DISABLED    0x04
  97.  
  98. /* Currently defined output_device values */
  99. #define    OUTPUT_STD    0
  100. #define    OUTPUT_MD16    1
  101. #define    OUTPUT_TOCC    2
  102.  
  103. struct MMDInstrInfo {
  104.     UBYTE    name[40];
  105.     UBYTE    pad0;    /* two pads? */
  106.     UBYTE    pad1;
  107. };
  108.  
  109. struct MMD0exp {
  110.     struct MMD0 *nextmod;        /* for multi-modules */
  111.     struct InstrExt *exp_smp;    /* pointer to an array of InstrExts */
  112.     UWORD  s_ext_entries;        /* # of InstrExts in the array */
  113.     UWORD  s_ext_entrsz;        /* size of an InstrExt structure */
  114.     UBYTE  *annotxt;        /* 0-terminated message string */
  115.     ULONG  annolen;            /* length (including the 0-byte) */
  116. /* MED V3.20 data below... */
  117.     struct MMDInstrInfo *iinfo;    /* "secondary" InstrExt for info
  118.                        that does not affect output */
  119.     UWORD  i_ext_entries;        /* # of MMDInstrInfos */
  120.     UWORD  i_ext_entrsz;        /* size of one */
  121.     ULONG  jumpmask;        /* OBSOLETE in current OctaMEDs */
  122.     UWORD  *rgbtable;        /* pointer to 8 UWORD values,
  123.                        ignored by OctaMED V5 and later */
  124.     UBYTE  channelsplit[4];    /* for OctaMED only (non-zero = NOT splitted) */
  125.     struct NotationInfo *n_info;    /* OctaMED notation editor info data */
  126.     UBYTE  *songname;    /* song name */
  127.     ULONG  songnamelen;    /* length (including terminating zero) */
  128.     struct MMDDumpData *dumps; /* MIDI message dump data */
  129.     struct MMDInfo *mmdinfo;   /* (V6) annotation information */
  130. /* These are still left, they must be 0 at the moment. */
  131.     ULONG  reserved2[6];
  132. };
  133.  
  134. /* Info for each instrument (mmd0->song.sample[xx]) */
  135.  
  136. struct MMD0sample {
  137.     UWORD rep,replen;    /* repeat/repeat length */
  138.     UBYTE midich;        /* midi channel for curr. instrument */
  139.     UBYTE midipreset;    /* midi preset (1 - 128), 0 = no preset */
  140.     UBYTE svol;        /* default volume */
  141.     BYTE strans;        /* sample transpose */
  142. };
  143.  
  144. /* The song structure (mmd0->song) */
  145.  
  146. struct MMD0song {
  147.     struct MMD0sample sample[63];    /* info for each instrument */
  148.     UWORD    numblocks;        /* number of blocks in this song */
  149.     UWORD    songlen;        /* number of playseq entries */
  150.     UBYTE    playseq[256];        /* the playseq list */
  151.     UWORD    deftempo;        /* default tempo */
  152.     BYTE    playtransp;        /* play transpose */
  153.     UBYTE    flags;            /* flags (see below) */
  154.     UBYTE    reserved;        /* for future expansion */
  155.     UBYTE    tempo2;            /* 2ndary tempo (delay betw. notes) */
  156.     UBYTE    trkvol[16];        /* track volume */
  157.     UBYTE    mastervol;        /* master volume */
  158.     UBYTE    numsamples;        /* number of instruments */
  159. }; /* length = 788 bytes */
  160.  
  161. /* The new PlaySeq structure of MMD2 */
  162.  
  163. struct PlaySeq {
  164.     char    name[32];    /* (0)  31 chars + \0 */
  165.     ULONG    reserved[2];    /* (32) for possible extensions */
  166.     UWORD    length;        /* (40) # of entries */
  167. /* Commented out, not all compilers may like it... */
  168. /*    UWORD    seq[0];    */    /* (42) block numbers.. */
  169. /* Note: seq[] values above 0x7FFF are reserved for future expansion! */
  170. };
  171.  
  172. /* This structure is used in MMD2s, instead of the above one.
  173.    (Be sure to cast the pointer.) */
  174.  
  175. struct MMD2song {
  176.     struct MMD0sample sample[63];
  177.     UWORD    numblocks;
  178.     UWORD    songlen;    /* NOTE: number of sections in MMD2 */
  179.     struct    PlaySeq **playseqtable;
  180.     UWORD    *sectiontable;    /* UWORD section numbers */
  181.     UBYTE    *trackvols;    /* UBYTE track volumes */
  182.     UWORD    numtracks;    /* max. number of tracks in the song
  183.                    (also the number of entries in
  184.                     'trackvols' table) */
  185.     UWORD    numpseqs;    /* number of PlaySeqs in 'playseqtable' */
  186.     UBYTE    pad0[240];    /* reserved for future expansion */
  187. /* Below fields are MMD0/MMD1-compatible (except pad1[]) */
  188.     UWORD    deftempo;
  189.     BYTE    playtransp;
  190.     UBYTE    flags;
  191.     UBYTE    flags2;
  192.     UBYTE    tempo2;
  193.     UBYTE    pad1[16];    /* used to be trackvols, in MMD2 reserved */
  194.     UBYTE    mastervol;
  195.     UBYTE    numsamples;
  196. };
  197.  
  198.  /* FLAGS of the above structure */
  199. #define    FLAG_FILTERON    0x1    /* hardware low-pass filter */
  200. #define    FLAG_JUMPINGON    0x2    /* OBSOLETE now, but retained for compatibility */
  201. #define    FLAG_JUMP8TH    0x4    /* also OBSOLETE */
  202. #define    FLAG_INSTRSATT    0x8    /* instruments are attached (sng+samples)
  203.                    used only in saved MED-songs */
  204. #define    FLAG_VOLHEX    0x10    /* volumes are represented as hex */
  205. #define FLAG_STSLIDE    0x20    /* no effects on 1st timing pulse (STS) */
  206. #define FLAG_8CHANNEL    0x40    /* OctaMED 8 channel song, examine this bit
  207.                    to find out which routine to use */
  208. #define    FLAG_SLOWHQ    0x80    /* HQ slows playing speed (V2-V4 compatibility) */
  209. /* flags2 */
  210. #define FLAG2_BMASK    0x1F
  211. #define FLAG2_BPM    0x20
  212.  
  213. struct MMDDump {
  214.     ULONG    length;        /* dump data length */
  215.     UBYTE    *data;        /* data pointer */
  216.     UWORD    ext_len;    /* bytes remaining in this struct */
  217. /* ext_len >= 20: */
  218.     UBYTE    name[20];    /* message name (null-terminated) */
  219. };
  220.  
  221. struct MMDDumpData {
  222.     UWORD    numdumps;    /* number of message dumps */
  223.     UWORD    reserved[3];    /* not currently used */
  224. };    // Followed by <numdumps> pointers to struct MMDDump
  225.  
  226. /* Designed so that several info items can exist (in V6 only one supported),
  227.    you must also check the data type before using it, currently only text is
  228.    supported, but more types can be added in the future.
  229.  
  230.    Text is stored in plain Amiga ASCII, lines separated by \n characters.
  231.    The last byte is \0.
  232. */
  233. struct MMDInfo {
  234.     struct MMDInfo *next;    /* next info (currently not supported) */
  235.     UWORD    reserved;    /* 0 */
  236.     UWORD    type;        /* 1 = text, ignore ALL other types */
  237.     ULONG    length;        /* length of the following data */
  238. /*    UBYTE    data[0]; */    /* Comments may be removed in SAS/C V6 */
  239. };
  240.  
  241. /* flags in struct NotationInfo */
  242. #define NFLG_FLAT 1
  243. #define NFLG_3_4  2
  244.  
  245. struct NotationInfo {
  246.     UBYTE n_of_sharps;    /* number of #'s (or b's) */
  247.     UBYTE flags;        /* flags (see above) */
  248.     WORD  trksel[5];    /* selected track for each preset (-1 = none) */
  249.     UBYTE trkshow[16];    /* which tracks to show (bit 0 = for preset 0,
  250.                 bit 1 for preset 1 and so on..) */
  251.     UBYTE trkghost[16];    /* ghosted tracks (like trkshow[]) */
  252.     BYTE  notetr[63];       /* -24 - +24 (if bit #6 is negated, hidden) */
  253.     UBYTE pad;    /* perhaps info about future extensions */
  254. };
  255.  
  256. /* This structure exists in V6+ blocks with multiple command pages */
  257. struct BlockCmdPageTable {
  258.     UWORD    num_pages;    // number of command pages
  259.     UWORD    reserved;    // zero = compatibility
  260.     UWORD    *page[0];    // page pointers follow...
  261. };
  262.  
  263. /* Below structs for MMD1 only! */
  264. struct BlockInfo {
  265.     ULONG    *hlmask;      /* highlight data */
  266.     UBYTE    *blockname;    /* block name */
  267.     ULONG    blocknamelen;    /* length of block name (including term. 0) */
  268.     struct    BlockCmdPageTable *pagetable;    /* (V6) command page table */
  269.     ULONG    reserved[5];    /* future expansion */
  270. };
  271.  
  272. struct MMD1Block {
  273.     UWORD numtracks;
  274.     UWORD lines;
  275.     struct BlockInfo *info;
  276. };
  277. #define MMD1BLKHDRSZ 8
  278.  
  279. /* This header exists in the beginning of each sample */
  280. struct MMDSample {
  281. /* length of one channel in bytes */
  282.     ULONG    length;
  283. /* see definitions below */
  284.     WORD    type;
  285. /* 8- or 16-bit data follows */
  286. };
  287.  
  288. /* Type definitions: */
  289. #define    SAMPLE        0
  290. #define    IFF5OCT        1
  291. #define    IFF3OCT        2
  292. #define IFF2OCT        3
  293. #define IFF4OCT        4
  294. #define IFF6OCT        5
  295. #define IFF7OCT        6
  296. /* low octaves usable */
  297. #define    EXTSAMPLE    7
  298. /* a standard synthsound */
  299. #define    SYNTHETIC    -1
  300. /* sample with synthetic information */
  301. #define    HYBRID        -2
  302. /* 16-bit (flag), only type SAMPLE supported */
  303. #define    S_16        0x10
  304. /* stereo (flag) */
  305. #define    STEREO        0x20
  306. /* only supported while reading... V5 Aura sample */
  307. #define    OBSOLETE_MD16    0x18
  308.  
  309. /* Please refer to 'MMD.txt' for a complete description of MMD file format. */
  310.