@SuppressWarnings({"rawtypes", "unchecked"}) private static void noteOn( int phrIndex, Note[] curNote, SMFTools smf, int i, double[] currentLength, double startTime, Vector phrVct, short midiChannel, short pitch, int dynamic, Vector evtList) { phrIndex = -1; // work out what phrase is ready to accept a note for (int p = 0; p < phrVct.size(); p++) { // Warning 0.02 should really be fixed if (currentLength[p] <= (startTime + 0.08)) { phrIndex = p; break; } } // need to create new phrase for a new voice? if (phrIndex == -1) { phrIndex = phrVct.size(); phrVct.addElement(new Phrase(startTime)); currentLength[phrIndex] = startTime; } // Do we need to add a rest ? if ((startTime > currentLength[phrIndex]) && (curNote[phrIndex] != null)) { double newTime = startTime - currentLength[phrIndex]; // perform a level of quantisation first if (newTime < 0.25) { double length = curNote[phrIndex].getRhythmValue(); curNote[phrIndex].setRhythmValue(length + newTime); } else { Note restNote = new Note(REST, newTime, 0); restNote.setPan(midiChannel); restNote.setDuration(newTime); restNote.setOffset(0.0); ((Phrase) phrVct.elementAt(phrIndex)).addNote(restNote); } currentLength[phrIndex] += newTime; } // get end time double time = MidiUtil.getEndEvt(pitch, evtList, i) / (double) smf.getPPQN(); // create the new note Note tempNote = new Note(pitch, time, dynamic); tempNote.setDuration(time); curNote[phrIndex] = tempNote; ((Phrase) phrVct.elementAt(phrIndex)).addNote(curNote[phrIndex]); currentLength[phrIndex] += curNote[phrIndex].getRhythmValue(); }
public void flam(double paramDouble) { int i = 0; Enumeration localEnumeration1 = this.phraseList.elements(); while (localEnumeration1.hasMoreElements()) { double d = paramDouble * i; Phrase localPhrase = (Phrase) localEnumeration1.nextElement(); Enumeration localEnumeration2 = localPhrase.getNoteList().elements(); while (localEnumeration2.hasMoreElements()) { Note localNote = (Note) localEnumeration2.nextElement(); localNote.setOffset(d); } i++; } }
/** * Returns a copy of this note * * @return Note */ public Note copy() { Note note; if (pitchType == MIDI_PITCH) { note = new Note(this.getPitch(), this.rhythmValue, this.dynamic); } else note = new Note(this.getFrequency(), this.rhythmValue, this.dynamic); note.setPan(this.pan); note.setDuration(this.duration); note.setOffset(this.offset); note.setSampleStartTime(this.sampleStartTime); note.setMyPhrase(this.myPhrase); for (int i = 0; i < breakPoints.length; i++) { if (this.breakPoints[i] != null) note.setBreakPoints(i, this.getBreakPoints(i)); } return note; }