use of com.xenoage.zong.core.music.format.Positioning in project Zong by Xenoage.
the class FermataReader method read.
public static Fermata read(MxlFermata mxlFermata, StaffDetails staffDetails) {
// determine position
Positioning positioning = new PositioningReader(staffDetails).readFromAny(mxlFermata);
if (positioning == null) {
if (mxlFermata.getType() == MxlUprightInverted.Upright)
positioning = Placement.Above;
else if (mxlFermata.getType() == MxlUprightInverted.Inverted)
positioning = Placement.Below;
}
Fermata fermata = new Fermata();
fermata.setPositioning(positioning);
return fermata;
}
use of com.xenoage.zong.core.music.format.Positioning in project Zong by Xenoage.
the class DirectionStamper method computePosition.
/**
* Computes the position for the given {@link Direction}
* within the given {@link StaffStamping}.
*/
private SP computePosition(Direction direction, StaffStamping staffStamping, float defaultLP, float defaultLPAbove, float defaultLPBelow) {
Positioning customPos = direction.getPositioning();
MP mp = direction.getMP();
if (mp == null)
// TODO. Happens. But just with offical MusicXML sample Telemann.xml
return SP.sp(0, 0);
float x, lp;
// default positioning
x = notNull(staffStamping.system.getXMmAt(mp.getTime()), 0f) + staffStamping.positionMm.x;
lp = defaultLP;
// custom positioning
if (customPos instanceof Placement) {
Placement placement = (Placement) customPos;
if (placement == Placement.Above)
lp = defaultLPAbove;
else
lp = defaultLPBelow;
} else if (customPos instanceof Position) {
// coordinates
Position pos = (Position) customPos;
if (pos.x != null)
x = pos.x;
x += Position.getRelativeX(pos);
// vertical position
if (pos.y != null)
lp = pos.y;
lp += Position.getRelativeY(pos);
}
return sp(x, lp);
}
use of com.xenoage.zong.core.music.format.Positioning in project Zong by Xenoage.
the class DynamicsReader method read.
public static Dynamic read(MxlDynamics mxlDynamics, StaffDetails staffDetails) {
DynamicValue type = mxlDynamics.getElement();
Positioning positioning = new PositioningReader(staffDetails).readFromAny(mxlDynamics);
Dynamic dynamics = new Dynamic(type);
dynamics.setPositioning(positioning);
return dynamics;
}
Aggregations