andrew@50
|
1 class MidiEvent { // the basic super class for all midi events
|
andrew@50
|
2
|
andrew@50
|
3 int firstDataByte;
|
andrew@50
|
4 int secondDataByte;
|
andrew@50
|
5 int channel;
|
andrew@50
|
6
|
andrew@50
|
7 }
|
andrew@50
|
8
|
andrew@50
|
9 //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
andrew@50
|
10
|
andrew@50
|
11 class NoteEvent extends MidiEvent{ // the note event class
|
andrew@50
|
12
|
andrew@50
|
13 int notePitch = 60;
|
andrew@50
|
14 int[] notePosition = new int[4];
|
andrew@50
|
15 int[] noteLength = new int[4];
|
andrew@50
|
16 int noteVelocity;
|
andrew@50
|
17 boolean noteIgnore;
|
andrew@50
|
18 boolean noteOn;
|
andrew@50
|
19
|
andrew@50
|
20
|
andrew@50
|
21 public NoteEvent(int notePitch, int channel, int bar, int beat, int fraction, int pulse, boolean noteOff) {
|
andrew@50
|
22 this.notePitch = notePitch;
|
andrew@50
|
23 this.channel = channel;
|
andrew@50
|
24 this.noteVelocity = 80;
|
andrew@50
|
25 if (noteOff)
|
andrew@50
|
26 this.noteVelocity = 0;
|
andrew@50
|
27 boolean noteIgnore = false;
|
andrew@50
|
28 this.noteOn = true;
|
andrew@50
|
29 }
|
andrew@50
|
30
|
andrew@50
|
31 public NoteEvent(int notePitch, int channel, int bar, int beat, int fraction, int pulse) {
|
andrew@50
|
32 this(notePitch, channel, bar, beat, fraction, pulse, false);
|
andrew@50
|
33 }
|
andrew@50
|
34
|
andrew@50
|
35 public NoteEvent(int notePitch, int channel, int veloc, int bar, int beat, int fraction, int pulse) {
|
andrew@50
|
36 this.notePitch = notePitch;
|
andrew@50
|
37 this.channel = channel;
|
andrew@50
|
38 this.noteVelocity = veloc;
|
andrew@50
|
39 boolean noteIgnore = false;
|
andrew@50
|
40 this.noteOn = true;
|
andrew@50
|
41 }
|
andrew@50
|
42
|
andrew@50
|
43
|
andrew@50
|
44 public NoteEvent(int notePitch, int channel, int bar, int beat, int fraction, int pulse, int lengthBar, int lengthBeat, int lengthFraction, int lengthPulse) {
|
andrew@50
|
45 this.notePitch = notePitch;
|
andrew@50
|
46 this.channel = channel;
|
andrew@50
|
47 this.noteVelocity = 80;
|
andrew@50
|
48 boolean noteIgnore = false;
|
andrew@50
|
49 this.noteOn = true;
|
andrew@50
|
50 notePosition[0] = bar;
|
andrew@50
|
51 notePosition[1] = beat;
|
andrew@50
|
52 notePosition[2] = fraction;
|
andrew@50
|
53 notePosition[3] = pulse;
|
andrew@50
|
54 noteLength[0] = lengthBar;
|
andrew@50
|
55 noteLength[1] = lengthBeat;
|
andrew@50
|
56 noteLength[2] = lengthFraction;
|
andrew@50
|
57 noteLength[3] = lengthPulse;
|
andrew@50
|
58 }
|
andrew@50
|
59
|
andrew@50
|
60 }
|
andrew@50
|
61
|