andrew@50: class MidiEvent { // the basic super class for all midi events andrew@50: andrew@50: int firstDataByte; andrew@50: int secondDataByte; andrew@50: int channel; andrew@50: andrew@50: } andrew@50: andrew@50: //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- andrew@50: andrew@50: class NoteEvent extends MidiEvent{ // the note event class andrew@50: andrew@50: int notePitch = 60; andrew@50: int[] notePosition = new int[4]; andrew@50: int[] noteLength = new int[4]; andrew@50: int noteVelocity; andrew@50: boolean noteIgnore; andrew@50: boolean noteOn; andrew@50: andrew@50: andrew@50: public NoteEvent(int notePitch, int channel, int bar, int beat, int fraction, int pulse, boolean noteOff) { andrew@50: this.notePitch = notePitch; andrew@50: this.channel = channel; andrew@50: this.noteVelocity = 80; andrew@50: if (noteOff) andrew@50: this.noteVelocity = 0; andrew@50: boolean noteIgnore = false; andrew@50: this.noteOn = true; andrew@50: } andrew@50: andrew@50: public NoteEvent(int notePitch, int channel, int bar, int beat, int fraction, int pulse) { andrew@50: this(notePitch, channel, bar, beat, fraction, pulse, false); andrew@50: } andrew@50: andrew@50: public NoteEvent(int notePitch, int channel, int veloc, int bar, int beat, int fraction, int pulse) { andrew@50: this.notePitch = notePitch; andrew@50: this.channel = channel; andrew@50: this.noteVelocity = veloc; andrew@50: boolean noteIgnore = false; andrew@50: this.noteOn = true; andrew@50: } andrew@50: andrew@50: andrew@50: public NoteEvent(int notePitch, int channel, int bar, int beat, int fraction, int pulse, int lengthBar, int lengthBeat, int lengthFraction, int lengthPulse) { andrew@50: this.notePitch = notePitch; andrew@50: this.channel = channel; andrew@50: this.noteVelocity = 80; andrew@50: boolean noteIgnore = false; andrew@50: this.noteOn = true; andrew@50: notePosition[0] = bar; andrew@50: notePosition[1] = beat; andrew@50: notePosition[2] = fraction; andrew@50: notePosition[3] = pulse; andrew@50: noteLength[0] = lengthBar; andrew@50: noteLength[1] = lengthBeat; andrew@50: noteLength[2] = lengthFraction; andrew@50: noteLength[3] = lengthPulse; andrew@50: } andrew@50: andrew@50: } andrew@50: