home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Elysian Archive
/
AmigaElysianArchive.iso
/
sound
/
midi
/
midi20.arc
/
XFile.43
< prev
next >
Wrap
Text File
|
1988-11-12
|
3KB
|
94 lines
#ifndef MIDI_MIDIFILE_H
#define MIDI_MIDIFILE_H
/*
MIDI Files definitions
---- ----- -----------
This is based on the MIDI Files spec 1.0 from IMA.
*/
#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif
/* chunks */
#define MFCK_NULL 0L
#define MFCK_MThd (ULONG)'MThd'
#define MFCK_MTrk (ULONG)'MTrk'
struct ckhdr { /* always at the beginning of a chunk */
ULONG id; /* id byte */
LONG len; /* length of chunk in bytes (bytes after this header) */
};
/* header */
struct mfheader { /* MIDI File header chunk */
UWORD format; /* format id */
UWORD ntracks; /* number of tracks */
WORD division; /* division if >0 is # of divisions per notated qtr note, <0 is SMPTE division (see spec) */
};
#define MFFMT_ONETRACK 0 /* single track */
#define MFFMT_SIMTRACKS 1 /* multiple simultaneous tracks */
#define MFFMT_INDTRACKS 2 /* multiple temporally indepent single-track patterns */
/* track */
/*
tracks consist of one or more events:
<channel msg> | <sysex msg> | <meta event>
<channel msg> uses running status so there may or may not be a
status byte here
<sysex msg>: F0 len data
F7 len data
F7 len data F7
where len is a variable length value.
<meta event>: FF type len data
(see spec for more info)
*/
/* special track event status bytes */
#define MS_ESCAPE 0xF7 /* either a sys/ex continuation or an "escape" sequence, tell apart using running status */
#define MS_META 0xFF /* meta event */
/* meta event types */
#define MFMETA_SEQNUM 0x00 /* FF 00 02 ssss: ssss is a sequence number */
#define MFMETA_TEXT 0x01 /* FF 01 len text: as are types 01 - 0F */
#define MFMETA_COPYRIGHT 0x02
#define MFMETA_TRACKNAME 0x03
#define MFMETA_INSTRNAME 0x04
#define MFMETA_LYRIC 0x05
#define MFMETA_MARKER 0x06
#define MFMETA_CUEPOINT 0x07
#define MFMETA_CHANPREFIX 0x20 /* FF 20 01 cc: Identifies channel for subsequent sys/ex and meta-events for track association */
#define MFMETA_TRACKEND 0x2f /* FF 2F 00: denote the end of a track and is mandatory */
#define MFMETA_TEMPO 0x51 /* FF 51 03 tttttt: set tempo in microseconds per MIDI qtr-note */
#define MFMETA_SMPTEOFFSET 0x54 /* FF 54 05 hr mn se fr ff: SMPTE offset */
#define MFMETA_TIMESIG 0x58 /* FF 58 04 nn dd cc bb: uses struct timesig below */
#define MFMETA_KEYSIG 0x59 /* FF 59 02 sf mi: key signature */
#define MFMETA_SEQSPEC 0x7f /* FF 7f len data: sequencer-specific meta-event */
struct mftimesig { /* MIDI File time signature */
UBYTE numerator; /* numerator */
UBYTE denompower; /* negative power of two of denominator */
UBYTE metronome; /* number of midi clocks per metronome click */
UBYTE division; /* number of notated 32nd-notes per midi qtr note */
};
#define TEMPOLEN 3 /* current length of tempo change */
#endif