4 ** Copyright (C) 1994,95 Bernardo Innocenti
6 ** Use 4 chars wide TABs to read this source
8 ** Structure definition for MED/OctaMED file formats.
9 ** Based on Teijo Kinnunen's format description rev 2 (30.5.93)
15 UWORD rep, replen; /* offs: 0(s), 2(s) */
16 UBYTE midich; /* offs: 4(s) */
17 UBYTE midipreset; /* offs: 5(s) */
18 UBYTE svol; /* offs: 6(s) */
19 BYTE strans; /* offs: 7(s) */
27 struct MMD0song *song;
29 struct MMD0Block **blockarr;
31 struct InstrHdr **smplarr;
33 struct MMD0exp *expdata;
35 UWORD pstate; /* some data for the player routine */
41 UBYTE extra_songs; /* number of songs - 1 */
42 }; /* length = 52 bytes */
48 struct MMD0sample sample[63];
50 UWORD songlen; /* NOTE: number of sections in MMD2 */
52 UBYTE playseq[256]; /* MMD0/MMD1 only */
53 struct { /* MMD2 only */
54 struct PlaySeq **playseqtable;
55 UWORD *sectiontable; /* UWORD section numbers */
56 UBYTE *trackvols; /* UBYTE track volumes */
57 UWORD numtracks; /* max. number of tracks in the song (also
58 * the number of entries in 'trackvols' table)
60 UWORD numpseqs; /* number of PlaySeqs in 'playseqtable' */
61 UBYTE pad0[240]; /* reserved for future expansion */
69 UBYTE trkvol[16]; /* Unused in MMD2 */
72 }; /* length = 788 bytes */
76 char name[32]; /* 31 chars + \0 */
77 ULONG reserved[2]; /* for possible extensions */
78 UWORD length; /* # of entries */
79 UWORD seq[0]; /* block numbers.. */
83 /* Flags for MMD0song->Flags */
85 #define FLAG_FILTERON 0x1 /* hardware low-pass filter */
86 #define FLAG_JUMPINGON 0x2 /* jumping.. */
87 #define FLAG_JUMP8TH 0x4 /* jump 8th.. */
88 #define FLAG_INSTRSATT 0x8 /* instruments are attached (sng+samples)
89 used only in saved MED-songs */
90 #define FLAG_VOLHEX 0x10 /* volumes are represented as hex */
91 #define FLAG_STSLIDE 0x20 /* no effects on 1st timing pulse (STS) */
92 #define FLAG_8CHANNEL 0x40 /* OctaMED 8 channel song, examine this bit
93 to find out which routine to use */
95 /* Flags for MMD0song->Flags2 */
97 #define FLAG2_BMASK 0x1F /* (bits 0-4) BPM beat length (in lines)
98 0 = 1 line, $1F = 32 lines.0
99 (The rightmost slider in OctaMED Pro
101 #define FLAG2_BPM 0x20 /* BPM mode on */
117 struct BlockInfo *info;
135 /* Followed by actual data */
139 /* Values for InstrHdr.type */
143 #define SAMPLE 0 /* ordinary 1 octave sample */
144 #define IFF5OCT 1 /* 5 octaves */
145 #define IFF3OCT 2 /* 3 octaves */
147 /* The following ones are recognized by OctaMED Pro only */
148 #define IFF2OCT 3 /* 2 octaves */
149 #define IFF4OCT 4 /* 4 octaves */
150 #define IFF6OCT 5 /* 6 octaves */
151 #define IFF7OCT 6 /* 7 octaves */
156 ULONG length; /* length of this struct */
157 WORD type; /* -1 or -2 */
169 struct SynthWF *wf[64];
175 UBYTE hold; /* hold/decay values of the instrument */
177 UBYTE suppress_midi_off; /* 0 (FALSE) or not (TRUE) */
178 BYTE finetune; /* instrument finetune (-8-+7) */
179 /* length = 4 bytes */
181 /* Below fields saved by >= V5 */
184 UWORD long_midi_preset;
185 /* length = 8 bytes */
187 /* Below fields saved by >= V5.02 */
190 /* length = 10 bytes */
195 struct MMDInstrInfo {
196 UBYTE name[40]; /* null-terminated instrument name. */
197 }; /* length = 40 bytes */
202 struct MMD0 *nextmod; /* Pointer to the next module (or zero). */
203 struct InstrExt *exp_smp;
204 UWORD s_ext_entries; /* The size of InstrExt structure array
205 * (i.e. the number of InstrExt structures).
207 UWORD s_ext_entrsz; /* Size of each InstrExt structure. */
208 UBYTE *annotxt; /* Pointer to the null-terminated annotation text. */
209 ULONG annolen; /* Length of 'annotxt', including the terminating \0. */
210 struct MMDInstrInfo *iinfo;
211 UWORD i_ext_entries; /* Size of the MMDInstrInfo struct array
212 * (i.e. the number of MMDInstrInfo structures).
214 UWORD i_ext_entrsz; /* Size of each MMDInstrInfo struct */
215 ULONG jumpmask; /* OBSOLETE */
216 UWORD *rgbtable; /* Pointer to eight UWORDs (screen colors)
217 * to be passed to LoadRGB4() routine.
219 UBYTE channelsplit[4]; /* this longword is divided to four boolean bytes,
220 * controlling channel splitting in OctaMED 5 - 8 chnl
221 * modes. (A non-zero byte means that the channel is
222 * NOT splitted.) Currently only the following
223 * combinations should be used:
225 * 0x00000000 (8 channels (or normal 4 channel mode))
226 * 0x000000FF (7 channels)
227 * 0x0000FFFF (6 channels)
228 * 0x00FFFFFF (5 channels)
230 struct NotationInfo *n_info;/* pointer to NotationInfo structure (used only in
231 * OctaMED V2.0 and later). It contains some info for
232 * the notation editor.
234 UBYTE *songname; /* song name of the current song (0-terminated).
235 * Each song of a multi-module can have a different
239 ULONG songnamelen; /* song name length (including the \0). */
240 struct MMDDumpData *dumps;
241 ULONG reserved2[7]; /* future expansion fields, that MUST be zero now. */
248 UBYTE n_of_sharps; /* number of sharps or flats (0 - 6). */
249 UBYTE flags; /* See below. */
250 WORD trksel[5]; /* The number of the selected track,
251 * for each display preset
252 * (-1 = no track selected)
254 UBYTE trkshow[16]; /* tracks shown (five bits used in
255 * each byte, bit #0 = preset 1, etc.)
257 UBYTE trkghost[16]; /* tracks ghosted (as in 'trkshow') */
258 BYTE notetr[63]; /* note transpose value for each
259 * instrument (-24 - +24). If bit 6 is
260 * negated, the instrument is hidden.
265 /* flags for NotationInfo->flags */
270 /* MIDI dump data (created using OctaMED Pro MIDI
277 /* Immediately after this struct, there are 'numdumps'
278 * pointers to MMDDump structures.
283 ULONG length; /* length of the MIDI message dump. */
284 UBYTE *data; /* pointer to the actual MIDI dump data. */
285 UWORD ext_len; /* MMDDump struct extension length. */
287 /* (if ext_len >= 20, the following fields exist) */
288 UBYTE name[20]; /* name of the dump. */
293 #define MMD0ROW 3 /* Size of an MMD0 pattern row */
294 #define MMD1ROW 4 /* Size of an MMD1/MMD2 pattern row */
296 #define ID_MMD0 0x4D4D4430
297 #define ID_MMD1 0x4D4D4431
298 #define ID_MMD2 0x4D4D4432