Mercurial > hg > movesynth
diff HeresyBigBangDone/NoteEvent.java @ 26:70dc11487078
Added Joe's Processing sketches to the repository.
author | Becky Stewart <rebecca.stewart@eecs.qmul.ac.uk> |
---|---|
date | Thu, 17 Feb 2011 18:08:19 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HeresyBigBangDone/NoteEvent.java Thu Feb 17 18:08:19 2011 +0000 @@ -0,0 +1,61 @@ + class MidiEvent { // the basic super class for all midi events + + int firstDataByte; + int secondDataByte; + int channel; + +} + +//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + + class NoteEvent extends MidiEvent{ // the note event class + + int notePitch = 60; + int[] notePosition = new int[4]; + int[] noteLength = new int[4]; + int noteVelocity; + boolean noteIgnore; + boolean noteOn; + + + public NoteEvent(int notePitch, int channel, int bar, int beat, int fraction, int pulse, boolean noteOff) { + this.notePitch = notePitch; + this.channel = channel; + this.noteVelocity = 80; + if (noteOff) + this.noteVelocity = 0; + boolean noteIgnore = false; + this.noteOn = true; + } + + public NoteEvent(int notePitch, int channel, int bar, int beat, int fraction, int pulse) { + this(notePitch, channel, bar, beat, fraction, pulse, false); + } + + public NoteEvent(int notePitch, int channel, int veloc, int bar, int beat, int fraction, int pulse) { + this.notePitch = notePitch; + this.channel = channel; + this.noteVelocity = veloc; + boolean noteIgnore = false; + this.noteOn = true; + } + + + public NoteEvent(int notePitch, int channel, int bar, int beat, int fraction, int pulse, int lengthBar, int lengthBeat, int lengthFraction, int lengthPulse) { + this.notePitch = notePitch; + this.channel = channel; + this.noteVelocity = 80; + boolean noteIgnore = false; + this.noteOn = true; + notePosition[0] = bar; + notePosition[1] = beat; + notePosition[2] = fraction; + notePosition[3] = pulse; + noteLength[0] = lengthBar; + noteLength[1] = lengthBeat; + noteLength[2] = lengthFraction; + noteLength[3] = lengthPulse; + } + +} +