midicomp.h
2.27 KB
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
#define MIDI_TYPE 0
#define META_TYPE 1
#define SYSEX_TYPE 2
#define META_PLACEHOLDER 0xFF
#define NO_LOOPEND 0xFFFFFFFF
#define BIG_LOOPCOUNT_ADD 0x80
#define MIN_MATCH_SIZE 6
#define MAX_MATCH_LEN 255
#define MAX_WIND_ADV 0xFDFF
class MIDIList : public List
{
public:
void MIDIList::endNote(long time, char chan, char key);
};
class MIDIComp : public MIDIFile
{
protected:
char *curOutPtr;
char *compData;
char *compTrackBufs[16];
long compTrackSizes[16];
char *trackBufs[16];
long trackSizes[16];
long hashMask;
char **hashTable;
char *nextHashPtr;
virtual void midiHeader(TrackHdr *hdr);
/* Meta Message handlers */
virtual void midiTempo(long tempo);
virtual void midiEndOfTrack();
/* Channel Message handlers */
virtual void midiNoteOn(char chan, char note, char velocity);
virtual void midiNoteOff(char chan, char note, char velocity);
virtual void midiKeyPressure(char chan, char key, char velocity);
virtual void midiControlChange(char chan, char control, char value);
virtual void midiPitchBend(char chan, char msb, char lsb);
virtual void midiProgramChange(char chan, char program);
virtual void midiChannelPressure(char chan, char pressure);
/* write operations */
virtual void writeHeader(void);
virtual void buildTrack(int track);
virtual void compressTracks(void);
virtual void compress1Track(long track);
long MIDIComp::deltaSize(long delta);
/* write sub routines */
void noteOn2Buf(char *trackBuf,long *bufOffset,Node *item);
void delta2Buf(char *trackBuf,long *bufOffset,long delta);
void TwoByteMidi2Buf(char *trackBuf,long *bufOffset,Node *item);
void ThreeByteMidi2Buf(char *trackBuf,long *bufOffset,Node *item);
void meta2Buf(char *trackBuf,long *bufOffset,Node *item);
void loopStart2Buf(char *trackBuf,long *bufOffset,Node *item);
void loopEnd2Buf(char *trackBuf,long *bufOffset,Node *item,long loopCount);
char *CopyData(char *src, char *dst, long len);
long matchPattern(char *test,char *tryPtr);
long HashString(char *str, long hashMask);
long HashSize(long numObjs);
public:
void Write(void);
long sequenceEnd;
long division;
};