1 #if !defined( QMUS2MID_H ) 2 #define QMUS2MID_H 3 4 typedef unsigned short int2; /* a two-byte int, use short.*/ 5 typedef unsigned int int4; /* a four-byte int, use int unless int is 6 16 bits, then use long. Don't use long 7 on an alpha. */ 8 9 #define NOTMUSFILE 1 /* Not a MUS file */ 10 #define COMUSFILE 2 /* Can't open MUS file */ 11 #define COTMPFILE 3 /* Can't open TMP file */ 12 #define CWMIDFILE 4 /* Can't write MID file */ 13 #define MUSFILECOR 5 /* MUS file corrupted */ 14 #define TOOMCHAN 6 /* Too many channels */ 15 #define MEMALLOC 7 /* Memory allocation error */ 16 17 /* some (old) compilers mistake the "MUS\x1A" construct (interpreting 18 it as "MUSx1A") */ 19 20 #define MUSMAGIC "MUS\032" /* this seems to work */ 21 #define MIDIMAGIC "MThd\000\000\000\006\000\001" 22 #define TRACKMAGIC1 "\000\377\003\035" 23 #define TRACKMAGIC2 "\000\377\057\000" 24 #define TRACKMAGIC3 "\000\377\002\026" 25 #define TRACKMAGIC4 "\000\377\131\002\000\000" 26 #define TRACKMAGIC5 "\000\377\121\003\011\243\032" 27 #define TRACKMAGIC6 "\000\377\057\000" 28 29 30 typedef struct 31 { 32 char ID[4]; /* identifier "MUS" 0x1A */ 33 int2 ScoreLength; 34 int2 ScoreStart; 35 int2 channels; /* count of primary channels */ 36 int2 SecChannels; /* count of secondary channels (?) */ 37 int2 InstrCnt; 38 int2 dummy; 39 /* variable-length part starts here */ 40 int2 *instruments; 41 } MUSheader; 42 43 struct Track 44 { 45 unsigned long current; 46 char vel; 47 long DeltaTime; 48 unsigned char LastEvent; 49 char *data; /* Primary data */ 50 }; 51 52 53 int qmus2mid( void *mus, size_t len, FILE *file_mid, 54 int nodisplay, int2 division, int BufferSize, int nocomp ); 55 56 #endif 57 58 59