/* SMUSGLOB.C
 *
 *  Global variables for SMUS <-> Music Studio conversion
 */
#include "smus.h"
#include "music.h"

  /* Music Studio sound and song array */
char mshead[10+150+(15*sizeof(struct Ainstr))+150+15+15+4*4+4+32+8+32000];

char *adsrname = &mshead[10];
char *adsrtbl = &mshead[10+150];
char *midname = &mshead[10+150+(15*sizeof(struct Ainstr))];
char *midcha = &mshead[10+150+(15*sizeof(struct Ainstr))+150];
char *midpre = &mshead[10+150+(15*sizeof(struct Ainstr))+150+15];
char *(*vptrs) = (char **) &mshead[10+150+(15*sizeof(struct Ainstr))+
                                   150+15+15];
char *(*textend) = (char **) &mshead[10+150+(15*sizeof(struct Ainstr))+
                                   150+15+15+4*4];
char *stitle = &mshead[10+150+(15*sizeof(struct Ainstr))+
                                   150+15+15+4*4+4];
char *tracks = &mshead[10+150+(15*sizeof(struct Ainstr))+
                                   150+15+15+4*4+4+32];
char *song = &mshead[10+150+(15*sizeof(struct Ainstr))+
                                   150+15+15+4*4+4+32+8];

  /* default Music Studio sound header used if no pallette file given */
char msinit[] = {
0xCE,0x4D,0x73,0x74,0x75,0x64,0x69,0x6F,0xCE,0x02,0x54,0x72,0x75,0x6D,0x70,0x65,
0x74,0x00,0x00,0x00,0x43,0x65,0x6C,0x6C,0x6F,0x00,0x00,0x00,0x00,0x00,0x4F,0x72,
0x67,0x61,0x6E,0x00,0x31,0x00,0x00,0x00,0x54,0x75,0x62,0x61,0x00,0x67,0x73,0x00,
0x00,0x00,0x42,0x65,0x6C,0x6C,0x73,0x00,0x32,0x00,0x00,0x00,0x48,0x61,0x72,0x6D,
0x6F,0x6E,0x69,0x63,0x61,0x00,0x46,0x75,0x6E,0x6B,0x50,0x69,0x61,0x6E,0x6F,0x00,
0x42,0x61,0x73,0x73,0x00,0x00,0x72,0x6E,0x00,0x00,0x42,0x61,0x73,0x73,0x6F,0x6F,
0x6E,0x00,0x00,0x00,0x4A,0x61,0x7A,0x7A,0x47,0x75,0x69,0x74,0x00,0x00,0x48,0x61,
0x72,0x6D,0x6F,0x6E,0x69,0x63,0x61,0x00,0x46,0x75,0x6E,0x6B,0x50,0x69,0x61,0x6E,
0x6F,0x00,0x42,0x61,0x73,0x73,0x00,0x42,0x61,0x73,0x73,0x00,0x53,0x74,0x72,0x69,
0x6E,0x67,0x73,0x00,0x00,0x00,0x46,0x72,0x2E,0x20,0x48,0x6F,0x72,0x6E,0x00,0x00,
0x33,0x30,0x11,0x12,0x07,0x07,0x03,0x7F,0x38,0x3D,0x3F,0x2C,0x16,0x10,0x08,0x00,
0x33,0x33,0x39,0x27,0x15,0x11,0x0D,0x00,0x16,0x14,0x0D,0x06,0x03,0x02,0x02,0x00,
0x0D,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x02,0x00,0x03,0xC0,0x04,
0x00,0x03,0x00,0x03,0x00,0x03,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x10,0x01,0x01,
0x06,0x02,0x01,0x01,0x02,0x01,0x01,0x7F,0x0D,0x04,0x02,0x01,0x02,0x01,0x00,0x00,
0x22,0x0A,0x02,0x02,0x03,0x01,0x01,0x00,0x36,0x0C,0x02,0x02,0x03,0x00,0x01,0x00,
0x3F,0x09,0x01,0x02,0x01,0x00,0x00,0x00,0x17,0x02,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,
0x00,0x04,0x00,0x08,0x00,0x0F,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x00,0x01,0x01,
0x3F,0x3F,0x39,0x35,0x35,0x34,0x34,0x7F,0x35,0x31,0x30,0x25,0x3B,0x19,0x19,0x00,
0x3A,0x34,0x2F,0x27,0x3F,0x10,0x10,0x00,0x35,0x31,0x30,0x1D,0x1B,0x19,0x19,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x0B,0x80,0x06,0x00,0x07,
0x40,0x04,0x00,0x04,0x00,0x00,0x01,0x02,0x03,0x05,0x46,0x46,0x47,0x10,0x01,0x01,
0x3F,0x3F,0x3F,0x3B,0x3C,0x3A,0x3A,0x7F,0x3F,0x3F,0x3F,0x1B,0x1C,0x19,0x1A,0x00,
0x3F,0x3F,0x3F,0x27,0x26,0x25,0x25,0x00,0x17,0x1A,0x12,0x0E,0x0E,0x0C,0x0E,0x00,
0x17,0x1A,0x12,0x0E,0x0E,0x0C,0x0E,0x00,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0xC0,0x12,0x00,0x0E,0x00,0x23,
0x00,0x23,0x00,0x2C,0x00,0x29,0x01,0x02,0x02,0x04,0x03,0x04,0x03,0x00,0x01,0x01,
0x07,0x15,0x21,0x32,0x3F,0x21,0x0F,0x7F,0x07,0x15,0x28,0x34,0x1F,0x0F,0x00,0x00,
0x07,0x15,0x27,0x17,0x0F,0x00,0x00,0x00,0x07,0x15,0x0F,0x0A,0x00,0x00,0x00,0x00,
0x07,0x0A,0x06,0x00,0x00,0x00,0x00,0x00,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x04,0x00,0x0A,0x00,0x10,
0x00,0x20,0x00,0x36,0x00,0x76,0x03,0x07,0x0B,0x0F,0x13,0x17,0x1B,0x00,0x01,0x01,
0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x3F,0x12,0x07,0x08,0x0A,0x07,0x0A,0x00,
0x3C,0x17,0x0F,0x08,0x0C,0x08,0x0B,0x00,0x36,0x11,0x07,0x09,0x09,0x06,0x08,0x00,
0x2D,0x0E,0x06,0x04,0x07,0x03,0x07,0x00,0x15,0x0D,0x04,0x02,0x05,0x02,0x06,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x03,0x00,0x0A,0x00,0x07,
0x00,0x19,0xC0,0x25,0x00,0x31,0x01,0x05,0x09,0x0D,0x11,0x15,0x19,0x18,0x01,0x05,
0x3B,0x3F,0x35,0x33,0x00,0x00,0x00,0x7F,0x00,0x04,0x0C,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x1A,0x00,0x1F,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x01,0x20,0x05,0x06,0x07,0x00,0x01,0x03,
0x22,0x29,0x20,0x02,0x03,0x01,0x01,0x7F,0x36,0x35,0x3D,0x02,0x03,0x00,0x01,0x00,
0x23,0x2D,0x38,0x02,0x01,0x00,0x00,0x00,0x17,0x1A,0x12,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x04,0x00,0x03,
0x00,0x08,0x00,0x00,0x00,0x00,0x01,0x20,0x02,0x04,0x05,0x06,0x07,0x00,0x01,0x01,
0x1A,0x3F,0x0D,0x07,0x05,0x00,0x00,0x7F,0x13,0x3B,0x0B,0x12,0x08,0x02,0x02,0x00,
0x13,0x34,0x0D,0x10,0x07,0x03,0x02,0x00,0x10,0x36,0x03,0x0A,0x05,0x01,0x02,0x00,
0x0E,0x30,0x02,0x02,0x04,0x00,0x00,0x00,0x03,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x03,0xC0,0x03,
0x00,0x01,0x00,0x03,0x00,0x03,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x10,0x01,0x01,
0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x3F,0x12,0x07,0x08,0x0A,0x07,0x0A,0x00,
0x3C,0x17,0x0F,0x08,0x0C,0x08,0x0B,0x00,0x36,0x11,0x07,0x09,0x09,0x06,0x08,0x00,
0x2D,0x0E,0x06,0x04,0x07,0x03,0x07,0x00,0x15,0x0D,0x04,0x02,0x05,0x02,0x06,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x00,0x01,0x00,0x02,
0x00,0x03,0xC0,0x02,0x00,0x04,0x01,0x02,0x03,0x04,0x20,0x08,0x09,0x10,0x01,0x01,
0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x3F,0x12,0x07,0x08,0x0A,0x07,0x0A,0x00,
0x3C,0x17,0x0F,0x08,0x0C,0x08,0x0B,0x00,0x36,0x11,0x07,0x09,0x09,0x06,0x08,0x00,
0x2D,0x0E,0x06,0x04,0x07,0x03,0x07,0x00,0x15,0x0D,0x04,0x02,0x05,0x02,0x06,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x03,0x00,0x0A,0x00,0x07,
0x00,0x19,0xC0,0x25,0x00,0x31,0x01,0x05,0x09,0x0D,0x11,0x15,0x19,0x18,0x01,0x05,
0x3B,0x3F,0x35,0x33,0x00,0x00,0x00,0x7F,0x00,0x04,0x0C,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x1A,0x00,0x1F,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x01,0x20,0x05,0x06,0x07,0x00,0x01,0x03,
0x22,0x29,0x20,0x02,0x03,0x01,0x01,0x7F,0x36,0x35,0x3D,0x02,0x03,0x00,0x01,0x00,
0x23,0x2D,0x38,0x02,0x01,0x00,0x00,0x00,0x17,0x1A,0x12,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x04,0x00,0x03,
0x00,0x08,0x00,0x00,0x00,0x00,0x01,0x20,0x02,0x04,0x05,0x06,0x07,0x00,0x01,0x01,
0x20,0x3F,0x01,0x20,0x04,0x06,0x10,0x7F,0x3E,0x1F,0x03,0x0F,0x00,0x05,0x00, 0x00,
0x1E,0x0E, 0x02, 0x03, 0x00, 0x03, 0x00, 0x00, 0x10, 0x02, 0x02, 0x04, 0x00, 0x03, 0x00, 0x00,
0x0B,0x02, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0C,
0x00,0x19, 0x00, 0x25, 0x00, 0x0A, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x01,
0x14,0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x3F, 0x1B, 0x05, 0x01, 0x01, 0x00, 0x00, 0x00,
0x39,0x32, 0x07, 0x05, 0x03, 0x01, 0x01, 0x00, 0x32, 0x2A, 0x06, 0x04, 0x02, 0x01, 0x01, 0x00,
0x10,0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0xC0, 0x03,
0x00,0x05, 0x00, 0x01, 0x00, 0x04, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x10, 0x01, 0x01,
0x42,0x6C, 0x6F, 0x63, 0x6B, 0x73, 0x00, 0x00, 0x00, 0x00, 0x48, 0x61, 0x72, 0x6D, 0x6F, 0x6E,
0x69,0x63, 0x61, 0x00, 0x47, 0x75, 0x69, 0x74, 0x61, 0x72, 0x00, 0x00, 0x00, 0x00, 0x46, 0x6C,
0x75,0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x6C, 0x61, 0x72, 0x69, 0x6E, 0x65, 0x74,
0x00,0x00, 0x42, 0x61, 0x72, 0x69, 0x74, 0x6F, 0x6E, 0x65, 0x00, 0x00, 0x48, 0x69, 0x68, 0x61,
0x74,0x00, 0x69, 0x61, 0x6E, 0x00, 0x53, 0x6E, 0x61, 0x72, 0x65, 0x00, 0x6F, 0x00, 0x00, 0x00,
0x42,0x2E, 0x46, 0x69, 0x64, 0x64, 0x6C, 0x65, 0x00, 0x00, 0x53, 0x61, 0x78, 0x00, 0x74, 0x6F,
0x6E,0x65, 0x00, 0x00, 0x43, 0x6C, 0x61, 0x72, 0x69, 0x6E, 0x65, 0x74, 0x00, 0x00, 0x50, 0x69,
0x61,0x6E, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x61, 0x73, 0x73, 0x00, 0x73, 0x00, 0x00,
0x00,0x00, 0x56, 0x69, 0x62, 0x65, 0x73, 0x00, 0x65, 0x74, 0x00, 0x00, 0x42, 0x65, 0x6C, 0x6C,
0x73,0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01,0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x0B, 0x01, 0x08, 0x01,
0x01,0x0E, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x6F, 0x6F, 0x67, 0x69, 0x65, 0x20, 0x62,
0x79,0x20, 0x45, 0x64, 0x20, 0x42, 0x6F, 0x67, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00,0x80, 0x01, 0x09, 0x83, 0x05, 0x81, 0xA0, 0x84, 0x01, 0x7F };

/*
 * This table gives the duration in 144th of a whole note for each
 *  Music Studio duration.
 * The note and rest durations stored in Music Studio songs are indices
 *  into this table.
 */
int DurTab[/* 22 */] = {
      0,       /* not to be used */
      2,       /* triplet 32nd   */
      2,       /* dotted 64th    */
      3,       /* 32nd  */
      4,       /* triplet sixteenth    */
      5,       /* dotted 32nd - don't use...not accurate */
      6,       /* sixteenth */
      8,       /* eighth triplet */
      9,       /* dotted sixteenth  */
      12,      /* eighth */
      16,      /* quarter triplet   */
      18,      /* dotted eighth  */
      24,      /* quarter */
      32,      /* half triplet   */
      36,      /* dotted quarter */
      48,      /* half */
      64,      /* whole triplet */
      72,      /* dotted half */
      96,      /* whole */
      128,     /* double triplet ? */
      144,     /* dotted whole */
      0   };   /* used for null frame */

/*
 * Table to search to find appropriate rests
 */
int RestTab[] = {
      3,       /* 32nd note */
      6,       /* sixteenth note */
      12,      /* eighth note */
      24,      /* quarter note */
      48,      /* half note */
      96,      /* whole note */
      0  } ;

/*
 * Indices of above table's entries in DurTab
 */
int RestDurInd[] = {
      3,       /* 3 = 32nd note */
      6,       /* 6 = 16th note */
      9,       /* 12 = eighth note */
      12,      /* 24 = quarter note */
      15,      /* 48 = half note */
      18,      /* 96 = whole note */
      0 } ;

/*
 * This table, when indexed by the Music Studio time signature
 *  number, yields the SMUS equivalent.  Also can be searched to
 *  convert in the other direction.  12 is the Null MS Time Sig.
 */
char TimeSigTab[] = {
      0x00,    /* filler byte; there is no 0 TimeSig in Music Studio */
      0x09,    /* 2/2 = MS key signature # 1 */
      0x11,    /* 3/2 = MS key signature # 2 */
      0x0A,    /* 2/4 */
      0x12,    /* 3/4 */
      0x1A,    /* 4/4 */
      0x22,    /* 5/4 */
      0x2C,    /* 6/8 = MS key signature # 7 */
      0     };    /* 0 marks end of table */


char  keytab[] = {      /* used at play time to translate note to
                           proper key--built on the fly for each key */
   0,1,2,3,4,5,6,7,8,9,
   10,11,12,13,14,15,16,17,18,19,
   20,21,22,23,24,25,26,27,28,29,
   30,31,32,33,34,35,36,37,38,39,
   40,41,42,43,44,45,46,47,48,49,
   50,51,52,53,54,55,56,57,58,59,
   60,61,62,63,64,65,66,67,68,69,
   70,71,72,73,74,75,76,77,78,79,
   80,81,82,83,84,85,86,87,88,89,
   90,91,92,93,94,95,96,97,98,99,
   100,101,102,103,104,105,106,107,108,109,
   110,111,112,113,114,115,116,117,118,119,
   120,121,122,123,124,125,126,127,128,129,
   130,131,132 };

char keychart[] = {   /* used to control building of keytab */
   0xFF,                /* everything same for key of C */
   0xFF,                /* filter byte */
   0x77,                /* bit guide for key of G  */
   0x37,                /* bit guide for key of D  */
   0x33,                /* bit guide for key of A  */
   0x13,                /* bit guide for key of E  */
   0x11,                /* bit guide for key of B  */
   0x01,                /* bit guide for key of FS */
   0x00,                /* bit guide for key of CS */
   0xFE,                /* bit guide for key of F  */
   0xEE,                /* bit guide for key of BF */
   0xEC,                /* bit guide for key of EF */
   0xCC,                /* bit guide for key of AF */
   0xC8,                /* bit guide for key of DF */
   0x88,                /* bit guide for key of GF */
   0x00   };            /* bit guide for key of CF */

/*
 * When indexed by the Music Studio duration, this table yields the
 *  corresponding IFF duration.
 */
int IFFDurTab[/* 22 */] = {
      0,       /* not to be used */
      0x15,       /* triplet 32nd   */
      0x0E,       /* dotted 64th    */
      0x05,       /* 32nd  */
      0x14,       /* triplet sixteenth    */
      0x0D,       /* dotted 32nd - don't use...not accurate */
      0x04,       /* sixteenth */
      0x13,       /* eighth triplet */
      0x0C,       /* dotted sixteenth  */
      0x03,      /* eighth */
      0x12,      /* quarter triplet   */
      0x0B,      /* dotted eighth  */
      0x02,      /* quarter */
      0x11,      /* half triplet   */
      0x0A,      /* dotted quarter */
      0x01,      /* half */
      0x10,      /* whole triplet */
      0x09,      /* dotted half */
      0x00,      /* whole */
      0x00,     /* double triplet ? */
      0x08,     /* dotted whole */
      0   };   /* used for null frame */

/*
 * When indexed with the IFF duration information, this table yields the
 *  corresponding Music Studio duration, or 0xFF if the IFF duration cannot
 *  be matched.  The Music Studio durations as given in the file are the
 *  indexes into DurTab given below.
 */
UBYTE MSDurTab[] = {
      /* 00 0 000 : whole note */                 18,
      /* 00 0 001 : half  note */                 15,
      /* 00 0 010 : quarter note */               12,
      /* 00 0 011 : eighth note */                9,
      /* 00 0 100 : sixteenth note */             6,
      /* 00 0 101 : thirty-second note */         3,
      /* 00 0 110 : 64th note */                  0xFF,
      /* 00 0 111 : 128th note */                 0xFF,
      /* 00 1 000 : dotted whole note */          20,
      /* 00 1 001 : dotted half note */           17,
      /* 00 1 010 : dotted quarter note */        14,
      /* 00 1 011 : dotted eighth note  */        11,
      /* 00 1 100 : dotted sixteenth note */      8,
      /* 00 1 101 : dotted thirty-second note */  6,  /* = 16th note */
      /* 00 1 110 : dotted 64th note */           3,  /* = 32nd note */
      /* 00 1 111 : dotted 128th note */          0xFF,
      /* 01 0 000 : triplet whole note */         16,
      /* 01 0 001 : triplet half note */          13,
      /* 01 0 010 : triplet quarter note */       10,
      /* 01 0 011 : triplet eighth note */        7,
      /* 01 0 100 : triplet sixteenth note */     4,
      /* 01 0 101 : triplet thirth-second note */ 1,
      /* 01 0 110 : triplet 64th note */          0xFF,
      /* 01 0 111 : triplet 128th note */         0xFF,
      /* 01 1 000 : dotted triplet whole */       15,    /* = half */
      /* 01 1 001 : dotted triplet half */        12,    /* = quarter */
      /* 01 1 010 : dotted triplet quarter */     9,     /* = eighth */
      /* 01 1 011 : dotted triplet eighth */      6,     /* = 16th */
      /* 01 1 100 : dotted triplet 16th */        3,     /* = 32nd */
      /* 01 1 101 : dotted triplet 32nd */        0xFF,
      /* 01 1 110 : dotted triplet 64th */        0xFF,
      /* 01 1 111 : dotted triplet 128th */       0xFF
    };

Track Tracks[MAXITRACKS];

MSTrak Traks[MAXCOLORS+1];

int   NumNotes[MAXCOLORS+1];  /* # of notes on each track */

int   NumTracks;     /* global # of tracks found in file */

char  *cursng;       /* cursor into Music Studio song */

int   MaxTracks;     /* Maximum number of tracks to create */

BOOL  IFFChords;     /* True if setting IFF Chord Bits */

BOOL  Debug;         /* True when printing debugging info */



