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