restLength = chordLength / 2;
}
addChord(chordPitches, chordLength - restLength, dynamics,
accompanimentPhrase, specialNoteType, preferChordNotesOffset,
measureOffset);
accompanimentPhrase.addRest(new Rest(restLength));
}
} else {
addChord(chordPitches, chordLength / 2, dynamics, accompanimentPhrase,
specialNoteType, preferChordNotesOffset, measureOffset);
addChord(chordPitches, chordLength / 2, dynamics, accompanimentPhrase,
specialNoteType, preferChordNotesOffset, measureOffset);
}
} else {
accompanimentPhrase.addRest(new Rest(chordLength));
}
measureChordLength += chordLength;
}
if (currentNote.isRest() && (currentMeasureSize == 0 || (interMeasureChord && isHalfMeasure))) {
accompanimentPhrase.addRest(new Rest(chordLength));
measureChordLength += chordLength;
}
currentMeasureSize += currentNote.getRhythmValue();
if (currentMeasureSize >= normalizedMeasureSize) {
// when there's a long note and so no inter-measure chord is possible, fill the measure with a rest
if (measureChordLength != currentMeasureSize) {
double fillingSize = normalizedMeasureSize - measureChordLength;
accompanimentPhrase.addRest(new Rest(fillingSize));
}
currentMeasureSize = 0;
measureChordLength = 0;
}
}