use of com.xenoage.zong.core.music.slur.SlurType in project Zong by Xenoage.
the class SlurReader method readToContext.
public static void readToContext(Chord chord, int noteIndex, int staffIndexInPart, Context context, MxlSlurOrTied mxlSlur) {
Pitch pitch = chord.getNotes().get(noteIndex).getPitch();
float noteLP = context.getMusicContext(staffIndexInPart).getLp(pitch);
// type
SlurType type = (mxlSlur.getElementType() == MxlElementType.Slur ? SlurType.Slur : SlurType.Tie);
// number (tied does usually not use a number, but is distinguished by pitch)
Integer number = mxlSlur.getNumber();
BezierPoint bezierPoint = readBezierPoint(mxlSlur.getPosition(), mxlSlur.getBezier(), context.getTenthMm(), context.getStaffLinesCount(staffIndexInPart), noteLP, chord.getDuration());
VSide side = readVSide(mxlSlur.getPlacement());
// waypoint
SlurWaypoint wp = new SlurWaypoint(chord, noteIndex, bezierPoint);
if (type == SlurType.Tie && number == null) {
// unnumbered tied
OpenUnnumberedTieds openTieds = context.getOpenElements().getOpenUnnumberedTies();
if (mxlSlur.getType() == MxlStartStopContinue.Start) {
openTieds.startTied(wp, side);
} else if (mxlSlur.getType() == MxlStartStopContinue.Stop) {
OpenSlur openTied = openTieds.stopTied(wp, side, context);
if (openTied != null)
context.createSlur(openTied);
}
} else {
// numbered
WaypointPosition wpPos;
if (mxlSlur.getType() == MxlStartStopContinue.Start)
wpPos = WaypointPosition.Start;
else if (mxlSlur.getType() == MxlStartStopContinue.Stop)
wpPos = WaypointPosition.Stop;
else
wpPos = WaypointPosition.Continue;
context.registerSlur(type, wpPos, number, wp, side);
}
}
Aggregations