use of blue.soundObject.pattern.Pattern in project blue by kunstmusik.
the class PatternObject method generateNotes.
/* COMPILATION METHODS */
public NoteList generateNotes(double renderStart, double renderEnd) throws SoundObjectException {
NoteList tempNoteList = new NoteList();
// check if solo is selected, if so, return only that layer's notes if
// not muted
boolean soloFound = false;
double timeIncrement = 1.0f / this.subDivisions;
for (int i = 0; i < this.size(); i++) {
Pattern p = this.getPattern(i);
if (p.isSolo() && !p.isMuted()) {
soloFound = true;
boolean[] tempPatternArray = p.values;
for (int j = 0; j < tempPatternArray.length; j++) {
if (tempPatternArray[j]) {
NoteList tempPattern;
try {
tempPattern = ScoreUtilities.getNotes(p.getPatternScore());
} catch (NoteParseException e) {
throw new SoundObjectException(this, e);
}
double start = (j * timeIncrement);
ScoreUtilities.setScoreStart(tempPattern, start);
tempNoteList.merge(tempPattern);
}
}
}
}
if (!soloFound) {
for (int i = 0; i < this.size(); i++) {
Pattern p = this.getPattern(i);
if (!p.isMuted()) {
boolean[] tempPatternArray = p.values;
for (int j = 0; j < tempPatternArray.length; j++) {
if (tempPatternArray[j]) {
NoteList tempPattern;
try {
tempPattern = ScoreUtilities.getNotes(p.getPatternScore());
} catch (NoteParseException e) {
throw new SoundObjectException(this, e);
}
double start = (j * timeIncrement);
ScoreUtilities.setScoreStart(tempPattern, start);
tempNoteList.merge(tempPattern);
}
}
}
}
}
try {
ScoreUtilities.applyNoteProcessorChain(tempNoteList, this.npc);
} catch (NoteProcessorException e) {
throw new SoundObjectException(this, e);
}
ScoreUtilities.applyTimeBehavior(tempNoteList, this.getTimeBehavior(), this.getSubjectiveDuration(), this.getRepeatPoint(), beats);
ScoreUtilities.setScoreStart(tempNoteList, startTime);
return tempNoteList;
}
Aggregations