use of com.xenoage.zong.commands.core.music.VoiceAdd in project Zong by Xenoage.
the class Context method writeVoiceElement.
/**
* Writes the given {@link VoiceElement} to the current position
* without moving the cursor forward. When the element could be written, true is returned,
* otherwise (e.g. when the measure was full), false is returned.
*/
public boolean writeVoiceElement(VoiceElement element, int staffIndexInPart, int voice) {
MP mp = this.mp.withStaff(getPartStaffIndices().getStart() + staffIndexInPart).withVoice(voice);
try {
// create voice if needed
Measure measure = score.getMeasure(mp);
if (measure.getVoices().size() < voice + 1)
execute(new VoiceAdd(measure, voice));
execute(new VoiceElementWrite(score.getVoice(mp), mp, element, writeVoicElementOptions));
return true;
} catch (MeasureFullException ex) {
reportError(ex.getMessage());
return false;
}
}
Aggregations